elkhayder
elkhayder

Reputation: 97

Enable Remember me option in laravel fortify

So, I've just built my website authentication system using laravel fortify, however, I'm finding a problem on how to implement the remember me option. I could use some help. if there's a built-in method in fortify it would be even better.

I am using laravel 8 and fortify 1.6

Upvotes: 3

Views: 4780

Answers (2)

elkhayder
elkhayder

Reputation: 97

So, after surfing in the whole fortify assets xD, I found that it accepts a second parameter in the attempt method which is rememberMe option as a "remember" post data name. So u just have to set the remember me checkbox name to "remember" and its gonna work like magic.

Upvotes: 2

MicB
MicB

Reputation: 171

According to this issue https://github.com/laravel/fortify/issues/17

Taylor suggests that you shouldn't use the Auth::attempt method in Fortify::authenticateUsing method as it will essentially be logging in twice.

You should use Auth::validate.

Btw, if you have an input (checkbox) named "remember" it will still be passed along.

Hope this helps someone, because I spent hours trying to get to the bottom of how to use remember with Fortify::authenticateUsing.

Upvotes: 6

Related Questions