-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set password_confirmed_at
on login
#208
Conversation
In my case, that's a breaking change. We use JWT and not the Session Store. {
"class": "RuntimeException",
"message": "Session store not set on request.",
"code": 0,
"file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Http/Request.php:502",
"trace": [
"/var/www/html/vendor/laravel/ui/auth-backend/AuthenticatesUsers.php:47",
"..."
} |
I have the same problem :/ Added |
Sorry, I didn't consider this would cause issues with session disabled. @jansgescheit @arthurkirkosa can you check if changing line 47 in optional($request->getSession())->put('auth.password_confirmed_at', time()); Or we could do just explicit if ($request->hasSession())
$request->session()->put('auth.password_confirmed_at', time()); |
@tontonsb I'll get that fixed. |
It works with both variants |
Released v3.3.2 which should fix the issues here. |
@tontonsb 👍 for the explicit variant |
It is useful to use the same `AuthenticatesUsers` trait for login via API as for login in the browser, because the trait provides things like throttling and validation. The problem is similar to the discussion in laravel#208 - API routes may not have a session. This PR adds `if ($request->hasSession()) {` the same as the comments in laravel#208 suggest. This also replaces laravel#90 properly.
The current behaviour is such that when an unauthenticated user is accessing a confirmation-protected route, they are first asked to log in and then instantly asked to confirm the password. That confuses users and also is redundant as they just entered the password.
I have made the most straightforward solution here — explicitly set the
password_confirmed_at
timestamp as the user logs in.