Laravel 5 Auth: These credentials do not match our records
In addition to @mervasdayi solution, a good way to hash passwords in setPasswordAttribute
avoiding rehashing problems could be this:
public function setPasswordAttribute($password){
$this->attributes['password'] = Hash::needsRehash($password) ? Hash::make($password) : $password;
}
I had the same issue. The reason for mine was that
I defined setPasswordAttribute
in my User
model so every time, I enter plain password, it hashes before sending to DB.
public function setPasswordAttribute($password)
{
$this->attributes['password'] = \Hash::make($password);
}
and in my db:seed, I was creating a user with hashed password with Hash::make("password")
, too. So laravel hashes hashed password :)
In laravel version 5.* you don't need to hash input password for Auth, because Auth manages it itself. you just have to pass {{csrf_field()}}
through form.