Implementation logic of login.