check first whether input form of username is legal

Change-Id: I0fd77816a25a2a3e77a456e556d7afba43a60f2a