Phauxth v0.10.2 Phauxth.Confirm
Module to provide user confirmation.
This Plug can be used to provide user confirmation by email, phone, or any other method.
Options
There are two options:
identifier - how the user is identified in the confirmation request
- this should be an atom, and the default is :email
key_validity - the length, in minutes, that the token is valid for
- the default is 60 minutes (1 hour)
Examples
Add the following line to the web/router.ex file:
get "/new", ConfirmController, :new
Then add the following to the confirm_controller.ex new function:
def new(conn, params) do
case Phauxth.Confirm.verify(params) do
{:ok, user} -> handle_successful_confirmation
{:error, message} -> handle_error
end
end
In handle_successful_confirmation, you still need to update the
database, setting the confirmed_at value, and send an email to
the user, stating that confirmation was successful.
Summary
Functions
Function to confirm the user by checking the token
Check the confirmation key
Generate a link containing a user-identifier and the confirmation token
Generate a confirmation token
Print out the log message and return {:ok, user} or {:error, message}
Functions
Generate a link containing a user-identifier and the confirmation token.