Coherence v0.5.2 Coherence.Config

Coherence Configuration Module.

Provides a small wrapper around Application.get_env :coherence, providing an accessor function for each configuration items.

Configuration items can be defined as either a single atom or {name, default} tuple. Each of the items can be included in your config/config.exs file.

The following items are supported:

  • :module - the name of project module (module: MyProject)
  • :web_module - the name of the project’s web module (web_module: MyProjectWeb)
  • :repo: the module name of your Repo (repo: MyProject.Repo)
  • :user_schema
  • :schema_key
  • :logged_out_url
  • :logged_in_url
  • :email_from - Deprecated. Use email_from_name and email_from_email instead
  • :email_from_name
  • :email_from_email
  • :email_reply_to - Set to true to add email_from_name and email_from_email
  • :email_reply_to_name
  • :email_reply_to_email
  • :site_name - The site name used for email
  • :login_cookie (“coherence_login”) - The name of the login cookie
  • :auth_module (Coherence.Authentication.Session)
  • :create_login (:create_login)
  • :update_login (:update_login)
  • :delete_login (:delete_login)
  • :opts ([])
  • :reset_token_expire_days (2)
  • :confirmation_token_expire_days (5)
  • :allow_unconfirmed_access_for (0) - default 0 days
  • :max_failed_login_attempts (5)
  • :unlock_timeout_minutes (20)
  • :unlock_token_expire_minutes (5)
  • :session_key (“session_auth”)
  • :rememberable_cookie_expire_hours (2*24)
  • :password_hash_field (:password_hash) - The field used to save the hashed password
  • :login_field (:email) - The user model field used to login
  • :changeset - Custom user changeset
  • :title - Layout page title
  • :layout - Customize the layout template e.g. {MyApp.LayoutView, “app.html”}
  • :async_rememberable? (false) - Don’t update rememberable seq_no for ajax requests
  • :user_token (false) - generate tokens for channel authentication
  • :token_assigns_key (:user_token) - key used to access the channel_token in the conn.assigns map
  • :token_generator (fn conn, user -> Phoenix.Token.sign(conn, “user socket”, user.id) end) - override the default
  • may also provide an arity 3 function as a tuple {Module, :function, args}
  • where apply(Module, function, args) will be used
  • :verify_user_token (fn socket, token -> Phoenix.Token.verify(socket, “user socket”, token, max_age: 2 7 24 60 60) end
  • can also be a 3 element tuple as described above for :token_generator
  • :use_binary_id (false) - Use binary ids.
  • :minimum_password_length The minimum password length to be accepted. Default value is 4.
  • :messages_backend - (MyApp.Coherence.Messages)
  • :router: the module name of your Router (router: MyProject.Router)
  • :user_active_field - Include the user active feature
  • :registration_permitted_attributes - List of allowed registration parameter attributes as strings
  • :invitation_permitted_attributes - List of allowed invitation parameter attribues as strings
  • :password_reset_permitted_attributes - List of allowed password reset atributes as stings,
  • :session_permitted_attributes - List of allowed session attributes as strings

Examples

alias Coherence.Config

Config.module

Link to this section Summary

Functions

Get a configuration item

Test if an option is configured and accepts a specific action

Test if an options is configured

Get title

Test if Phoenix is configured to use binary ids by default

Link to this section Functions

Link to this function allow_silent_password_recovery_for_unknown_user(opts \\ false)
Link to this function allow_unconfirmed_access_for(opts \\ 0)
Link to this function assigns_key(opts \\ :current_user)
Link to this function async_rememberable?(opts \\ false)
Link to this function auth_module(opts \\ Coherence.Authentication.Session)
Link to this function changeset(opts \\ nil)
Link to this function confirmation_token_expire_days(opts \\ 5)
Link to this function create_login(opts \\ :create_login)
Link to this function default_routes()
Link to this function delete_login(opts \\ :delete_login)
Link to this function email_from()
email_from() :: {nil, nil} | {String.t(), String.t()} | String.t()
Link to this function email_from_email(opts \\ nil)
Link to this function email_from_name(opts \\ nil)
Link to this function email_reply_to()
email_reply_to() :: nil | true | {String.t(), String.t()} | String.t()
Link to this function email_reply_to_email(opts \\ nil)
Link to this function email_reply_to_name(opts \\ nil)
Link to this function forwarded_invitation_fields(opts \\ [:email, :name])
Link to this function get(key, default \\ nil)
get(atom(), any()) :: any()

Get a configuration item.

Link to this function has_action?(option, action)
has_action?(atom(), atom()) :: boolean()

Test if an option is configured and accepts a specific action

Link to this function has_option(option)
has_option(atom()) :: boolean()

Test if an options is configured.

Link to this function invitation_permitted_attributes(opts \\ nil)
Link to this function layout(opts \\ nil)
Link to this function logged_in_url(opts \\ nil)
Link to this function logged_out_url(opts \\ nil)
Link to this function login_cookie(opts \\ "coherence_login")
Link to this function login_field(opts \\ :email)
Link to this function max_failed_login_attempts(opts \\ 5)
Link to this function messages_backend(opts \\ nil)
Link to this function minimum_password_length(opts \\ 4)
Link to this function module(opts \\ nil)
Link to this function opts(opts \\ [])
Link to this macro password_hash() (macro)
Link to this function password_hash_field(opts \\ :password_hash)
Link to this function password_reset_permitted_attributes(opts \\ nil)
Link to this function registration_permitted_attributes(opts \\ nil)
Link to this function repo(opts \\ nil)
Link to this function require_current_password(opts \\ true)
Link to this function reset_token_expire_days(opts \\ 2)
Link to this function router(opts \\ nil)
Link to this function schema_key(opts \\ nil)
Link to this function session_key(opts \\ "session_auth")
Link to this function session_permitted_attributes(opts \\ nil)
Link to this function site_name(opts \\ nil)
Link to this function title()
title() :: String.t() | nil

Get title

Link to this function token_assigns_key(opts \\ :user_token)
Link to this function token_generator(opts \\ &Coherence.SessionService.sign_user_token/2)
Link to this function unlock_timeout_minutes(opts \\ 20)
Link to this function unlock_token_expire_minutes(opts \\ 5)
Link to this function update_login(opts \\ :update_login)
Link to this function use_binary_id(opts \\ nil)
Link to this function use_binary_id?()
use_binary_id?() :: boolean()

Test if Phoenix is configured to use binary ids by default

Link to this function user_active_field(opts \\ nil)
Link to this function user_schema(opts \\ nil)
Link to this function user_token(opts \\ nil)
Link to this function verify_user_token(opts \\ &Coherence.SessionService.verify_user_token/2)
Link to this function web_module(opts \\ nil)