Phauxth v1.2.5 Phauxth.Login.Base View Source
Base module for handling login.
This is used by Phauxth.Login and can also be used to create custom login modules.
Custom login modules
One example of a custom login module is provided by the Phauxth.Confirm.Login module, which is shown below:
defmodule Phauxth.Confirm.Login do
use Phauxth.Login.Base
def check_pass(%{confirmed_at: nil}, _, _, _), do: {:error, "account unconfirmed"}
def check_pass(user, password, crypto, opts) do
super(user, password, crypto, opts)
end
end
In this example, the check_pass function is overridden to check the user struct to see if the user is confirmed. If the user has not been confirmed, an error is returned. Otherwise, the default check_pass function is run.