Phauxth v2.0.0-alpha.4 Phauxth.Remember View Source
Remember me module.
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:
:user_context
- the users module to be used when querying the database- the default is Phauxth.Config.user_context()
:log_meta
- additional custom metadata for Phauxth.Log- this should be a keyword list
There are also options for signing / verifying the token. See the documentation for the Phauxth.Token module for details.
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
Link to this section Functions
Link to this function
add_rem_cookie(conn, user_id, max_age \\ 604800)
View Source
add_rem_cookie(Plug.Conn.t(), integer(), integer()) :: Plug.Conn.t()
Adds a remember me cookie to the conn.
Link to this function
delete_rem_cookie(conn)
View Source
delete_rem_cookie(Plug.Conn.t()) :: Plug.Conn.t()
Deletes the remember_me cookie from the conn.