fix the logic of the login action