I had a pretty tough bug to debug today, my reseted password using the Laravel resets password trait was not working. After some research I was able to define what was causing this bug and how I could resolve it.
If you are like me you would probably have set a mutator on your user model that Hashes the password before saving it in the database.
public function setPasswordAttribute($password) { $this->attributes['password'] = Hash::make($password); }
Now when you look in the ResetsPassword trait you will see that Laravel also hashes the new password. So the password was hashed twice, that’s why the new password was not working.
protected function resetPassword($user, $password) { $user->forceFill([ 'password' => bcrypt($password), 'remember_token' => Str::random(60), ])->save(); Auth::guard($this->getGuard())->login($user); }
Since I was not using the dafault Laravel Trait anyway (due to some custom stuff) I could just remove the bcrypt function in my controller. Now I was able to login again. If you are using the default Trait you will have to find another work around or remove your mutator.
If you are using the default Trait you will have to find another work around or remove your mutator.