Coherence.ConfirmableService (Coherence v0.8.0)
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)
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.
Functions
confirm(user)
@spec confirm(Ecto.Schema.t()) :: Ecto.Changeset.t()
Confirm a user account.
Adds the :confirmed_at
datetime field on the user model.
deprecated! Please use Coherence.ControllerHelpers.unlock!/1.
confirm!(user)
@spec 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.
confirmed?(user)
@spec confirmed?(Ecto.Schema.t()) :: boolean()
Checks if the user has been confirmed.
Returns true if confirmed, false otherwise
expired?(user)
@spec expired?(Ecto.Schema.t()) :: boolean()
Checks if the confirmation token has expired.
Returns true when the confirmation has expired.
unconfirmed_access?(user)
@spec 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.