Openmaize v3.0.1 Openmaize.Remember

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

This needs to be run after plug Openmaize.Authenticate.

This Plug checks 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.

Summary

Functions

Sign cookie and add it to the conn

Delete the remember_me cookie

Generate a signing salt for use with this module

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.

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"