Cleaned up Register button logic

Username length will be checked before register
Password length will be checked before register
Cleaned up code behind Register button