MasoniteFramework / masonite

The Modern And Developer Centric Python Web Framework. Be sure to read the documentation and join the Discord channel for questions: https://discord.gg/TwKeFahmPZ
http://docs.masoniteproject.com
MIT License
2.21k stars 126 forks source link

remember me password #738

Open ssestantech opened 1 year ago

ssestantech commented 1 year ago

Is your feature request related to a problem?

remember me password

What do we currently have to do now?

remember me password

Describe the solution you'd like

remember me password checkbox functionality. how will i implement on login page. any doc for this.

Describe alternatives you've considered

No response

Would this be a breaking change ?

Anything else ?

No response

circulon commented 1 year ago

@ssestantech

The simplest way is probably to use a cookie or session to store the user data (depending on the size of the data) during the Login (authentication) flow. When seting the data define an expiry time for that data lifetime.

If the remember me is checked then a longer time is set until the session/cookie data expires if not set a default which is defined in the config.session file as part of the driver options

The LoadUserMiddleware is a good place to start digging in to understand the logic as it is loaded (by default) after the SessionMiddleware. This will show you how the these middlewares work together.

You can the customise your own LoadUserMiddleware if additional logic is necessary.

Hope this helps