Refactor the action of user login.