Phauxth v0.15.0 Phauxth.Login.Base View Source

Base module for handling login.

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, crypto_opts) do
    super(user, password, crypto, crypto_opts)
  end
end

In the Phauxth.Confirm.Login module, the user struct is checked 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.