I am adding some implementation which allows a user to update there password within a admin panel given that they provide the correct current password.
The issue I am facing is that the use upon updating the password is logged out because the password_hash
no longer matches in the session, I know this as I've commented out the middleware AuthenticateSession
.
I can see here that there is a check for the session value of password_hash
with a suffix of the default driver.
if ($request->session()->get('password_hash_'.$this->auth->getDefaultDriver()) !== $request->user()->getAuthPassword()) {
$this->logout($request);
}
It seems asthough I am ALWAYS hitting this, although when updating the password I am setting the session variable to be the users new password.
$user->password = Hash::make($request->input('password'));
$user->save();
auth()->guard('web')->login($user, true);
$request->session()->put([
'password_hash_' . auth()->getDefaultDriver() => $user->getAuthPassword(),
]);
Even with this, I hit the logout method, obviously I don't want to remove the middleware as it's useful incase an account gets compromised.