Phauxth v0.8.1 Phauxth.Login.Base

Base module for handling login.

This module is used by Phauxth.Login, and it can also be used to create customized Plugs to handle login.

Custom login modules

The init/1, call/2 and check_pass/2 functions can all be overridden.

One example of a custom login module is provided by the Phauxth.Confirm.Login module, which extends this base module by adding a check to see if the user has been successfully confirmed.

Custom module for password authentication

You can use a different module to handle password authentication by overriding the check_pass/2 function.

Custom value for the hash name (in the database)

Overriding the check_pass/2 function will also let you use a different value to refer to the password hash (:password_hash is the default).

Summary

Functions

Prints out a log message and adds a phauxth_user or phauxth_error message to the conn

Functions

report(arg, conn, user_id, ok_log)

Prints out a log message and adds a phauxth_user or phauxth_error message to the conn.

The first argument to the function should be {:ok, user}, {:error, error_log} or {:error, error_log, error_msg}. error_log refers to what will be reported in the logs, and error_msg will be what the end user sees. If you call this function without a custom error_msg, the default value of Invalid credentials will be used.