Laravel 4 authentication not working

前端 未结 3 1601
耶瑟儿~
耶瑟儿~ 2020-12-17 21:14

I have a Laravel 4 app in which I have set up one user. In my login route I\'m calling Auth::attempt with the email and password but it always comes back as fal

相关标签:
3条回答
  • 2020-12-17 21:51

    I found the problem. As suggested by Jason in the comment above, I had modified the models/User.php file and removed some functions that I didn't realise were necessary.

    The getAuthIdentifier() and getAuthPassword() methods must be included in the User model for authentication!

    0 讨论(0)
  • 2020-12-17 21:56

    In app/config/app.php make sure you have the 'key' set. This made me pull my hair out. Everything will apear to work, password seems hashed in the DB, but it will always return false until you set this key and re-hash your password into the DB.

    "php artisan key:generate"

    0 讨论(0)
  • 2020-12-17 21:58

    Had the same problem and made me sweat for hours. Definitively check your User.php model and make sure you have not overwritten the default one. Thanks Jason!

    0 讨论(0)
提交回复
热议问题