Phauxth v0.13.0-rc.0 Phauxth.Confirm.Login View Source

A custom login function which also checks to see if the user’s account has been confirmed yet.

Link to this section Summary

Functions

If confirmed_at: nil is in the user struct, this function will return {:error, message}. Otherwise, it will run the default check_pass function

Verify a user’s password

Link to this section Functions

Link to this function check_pass(user, password, crypto, opts) View Source

If confirmed_at: nil is in the user struct, this function will return {:error, message}. Otherwise, it will run the default check_pass function.

Link to this function verify(params, user_context, opts \\ []) View Source

Verify a user’s password.

Examples

The example below shows how you can use this function in the create function of a Phoenix session controller:

def create(conn, %{"session" => params}) do
  case Phauxth.Login.verify(params, MyApp.Accounts) do
    {:ok, user} -> handle_successful_login
    {:error, message} -> handle_error
  end
end