Phauxth v0.16.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 cookie / token
- the default is one week
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 remember me cookie to the conn
Check the session for the current user
Check the token for the current user
Delete the remember_me cookie from the conn
Get the user based on the session id or token id
Log the result of the authentication and return the user struct or nil
Set the current_user
variable
Link to this section Functions
Add a remember me cookie to the conn.
Check the session for the current user.
Check the token for the current user.
Delete the remember_me cookie from the conn.
Get the user based on the session id or token id.
This function also calls the database to get user information.
Log the result of the authentication and return the user struct or nil.
Set the current_user
variable.