{"id":"ef55a24d33ab9159","repo":"laravel/framework","slug":"the-given-password-does-not-match-the-current-pass","errorCode":null,"errorMessage":"The given password does not match the current password.","messagePattern":"The given password does not match the current password\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Illuminate/Auth/SessionGuard.php","lineNumber":771,"sourceCode":"        $this->fireOtherDeviceLogoutEvent($this->user());\n\n        return $result;\n    }\n\n    /**\n     * Rehash the current user's password for logging out other devices via AuthenticateSession.\n     *\n     * @param  string  $password\n     * @return \\Illuminate\\Contracts\\Auth\\Authenticatable|null\n     *\n     * @throws \\InvalidArgumentException\n     */\n    protected function rehashUserPasswordForDeviceLogout(#[\\SensitiveParameter] $password)\n    {\n        $user = $this->user();\n\n        if (! Hash::check($password, $user->getAuthPassword())) {\n            throw new InvalidArgumentException('The given password does not match the current password.');\n        }\n\n        $this->provider->rehashPasswordIfRequired(\n            $user, ['password' => $password], force: true\n        );\n    }\n\n    /**\n     * Register an authentication attempt event listener.\n     *\n     * @param  mixed  $callback\n     * @return void\n     */\n    public function attempting($callback)\n    {\n        $this->events?->listen(Events\\Attempting::class, $callback);\n    }\n","sourceCodeStart":753,"sourceCodeEnd":789,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Auth/SessionGuard.php#L753-L789","documentation":"Thrown by SessionGuard::rehashUserPasswordForDeviceLogout() (invoked via Auth::logoutOtherDevices($password)) when Hash::check($password, $user->getAuthPassword()) is false. The guard refuses to invalidate other sessions unless the caller proves knowledge of the current password.","triggerScenarios":"Calling Auth::logoutOtherDevices($password) with a password that does not match the authenticated user's stored hash.","commonSituations":"User typed the wrong 'current password' in a 'log out other devices' form; the password was changed elsewhere; the user model's getAuthPassword() returns a non-bcrypt/argon column.","solutions":["Validate the password against the user before calling logoutOtherDevices().","Show a clear 'current password incorrect' message in the form UI.","Ensure the password column is hashed with the configured hasher (config/hashing.php).","Catch InvalidArgumentException to render a friendly validation error."],"exampleFix":"// before\nAuth::logoutOtherDevices($request->input('password'));\n// throws InvalidArgumentException on mismatch\n\n// after\n$validated = $request->validate([\n    'password' => ['required', function ($attr, $value, $fail) {\n        if (! \\Illuminate\\Support\\Facades\\Hash::check($value, auth()->user()->getAuthPassword())) {\n            $fail('The current password is incorrect.');\n        }\n    }],\n]);\nAuth::logoutOtherDevices($validated['password']);","handlingStrategy":"validation","validationCode":"$password = $request->input('password');\nif (! \\Illuminate\\Support\\Facades\\Hash::check($password, Auth::user()->getAuthPassword())) {\n    return back()->withErrors(['password' => 'The current password is incorrect.']);\n}\nAuth::logoutOtherDevices($password);","typeGuard":"function currentPasswordMatches(string $password): bool\n{\n    return Hash::check($password, Auth::user()->getAuthPassword());\n}","tryCatchPattern":"try {\n    Auth::logoutOtherDevices($request->input('password'));\n} catch (\\InvalidArgumentException $e) {\n    return back()->withErrors(['password' => $e->getMessage()]);\n}","preventionTips":["Hash::check the supplied password before calling logoutOtherDevices().","Show an explicit 'current password incorrect' validation message.","Ensure the configured hasher matches the column that stores the password."],"tags":["authentication","password","session","validation","laravel"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}