fix the logic of login

fix the logic of login