Finish a rough code for register and login.