Openmaize v2.5.1 Openmaize.Remember

Module to help authenticate users who have persistent (remember me) access enabled.

This needs to be run after plug Openmaize.Authenticate.

Summary

Functions

Sign cookie and add it to the conn

Check for a remember_me cookie, and if the current_user is not set, authenticate the user using this cookie

Delete the remember_me cookie

Generate a signing salt for use with this module

Callback implementation for Plug.init/1

Functions

add_cookie(conn, data, max_age \\ 604800)

Sign cookie and add it to the conn.

The max_age is set to 604_800 seconds (7 days) by default.

call(conn, arg2)

Check for a remember_me cookie, and if the current_user is not set, authenticate the user using this cookie.

If the check is successful, the user will be added to the current session and to the current_user.

If the check is unsuccessful, an error message will be sent to conn.private.openmaize_error.

delete_rem_cookie(conn)

Delete the remember_me cookie.

gen_salt(length \\ 16)

Generate a signing salt for use with this module.

After running gen_salt, add the following lines to your config:

config :openmaize,
  remember_salt: "generated salt"
init(opts)

Callback implementation for Plug.init/1.