Phauxth v1.2.0 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.

Link to this section Summary

Functions

Prints out a log message and returns {:ok, user} or {:error, message}

Link to this section Functions

Link to this function report(arg, ok_message, meta) View Source

Prints out a log message and returns {:ok, user} or {:error, message}.