users->update($user, ['password' => $password]); $user->setRememberToken(Str::random(60)); $user->save(); Activity::event('user:account.password-changed')->subject($user)->log(); // Users changing their own password keep this session. A reset link has no session // to keep, and is never signed in here: an account with two-factor authentication // still has to pass its checkpoint. $guard = Auth::guard(Auth::getDefaultDriver()); $current = $guard->user(); if ($current instanceof User && $current->is($user)) { $guard->setUser($user); if (method_exists($guard, 'logoutOtherDevices')) { $guard->logoutOtherDevices($password); } } return $user; } }