Refine login and register

If user uses existing username to register a new account, he/she will
fail.
If login with wrong password, the username still in the blank.