Coherence v0.5.1 Coherence.ConfirmableService

Confirmable allows users to confirm a new account.

When enabled, newly created accounts are emailed send a confirmation email with a confirmation link. Clicking on the confirmation link enables the account.

Access to the account is disabled until the account is enabled, unless the the allow_unconfirmed_access_for option is configured. If the account is not confirmed before the confirmation_token_expire_days configuration days expires, a new confirmation must be sent.

Confirmable adds the following database columns to the user model:

  • :confirmation_token - a unique token required to confirm the account
  • :confirmed_at - time and date the account was confirmed
  • :confirmation_sent_at - the time and date the confirmation token was created

The following configuration is used to customize confirmable behavior:

  • :confirmation_token_expire_days - number days to allow confirmation. default 5 days
  • :allow_unconfirmed_access_for - number of days to allow login access to the account before confirmation. default 0 (disabled)

Link to this section Summary

Functions

Confirm a user account

Confirm a user account

Checks if the user has been confirmed

Checks if the confirmation token has expired

Checks if the user can access the account before confirmation

Link to this section Functions

Confirm a user account.

Adds the :confirmed_at datetime field on the user model.

deprecated! Please use Coherence.ControllerHelpers.unlock!/1.

Link to this function confirm!(user)
confirm!(Ecto.Schema.t()) :: Ecto.Changeset.t() | {:error, Ecto.Changeset.t()}

Confirm a user account.

Adds the :confirmed_at datetime field on the user model.

deprecated! Please use Coherence.ControllerHelpers.unlock!/1.

Link to this function confirmed?(user)
confirmed?(Ecto.Schema.t()) :: boolean()

Checks if the user has been confirmed.

Returns true if confirmed, false otherwise

Link to this function expired?(user)
expired?(Ecto.Schema.t()) :: boolean()

Checks if the confirmation token has expired.

Returns true when the confirmation has expired.

Link to this function unconfirmed_access?(user)
unconfirmed_access?(Ecto.Schema.t()) :: boolean()

Checks if the user can access the account before confirmation.

Returns true if the unconfirmed access has not expired.