Phauxth v0.14.0 Phauxth.Remember View Source
Remember me module.
Calling Phauxth.Remember with plug checks for a remember_me
cookie,
which contains a token. The token is then checked, and if it is valid,
the user is added to the session.
This module also contains functions to add / delete the remember_me
cookie.
Options
There are two options:
max_age - the length of the validity of the token
- the default is two weeks
user_context - the user context module to be used
- the default is MyApp.Accounts
Examples
Add the following line to the pipeline you want to authenticate in
the web/router.ex
file:
plug Phauxth.Authenticate
plug Phauxth.Remember
Make sure you add the Phauxth.Remember Plug after Phauxth.Authenticate.
Link to this section Summary
Functions
Add a token as a remember me cookie
Verify the token
Delete the remember_me cookie
Get the user based on the session id or token id
Set the current_user
variable
Link to this section Functions
Add a token as a remember me cookie.
Verify the token.
This function can be overridden if you want to use a different token implementation.
Delete the remember_me cookie.
Get the user based on the session id or token id.
This function also calls the database to get user information.
Set the current_user
variable.