You need to use Elixir version 1.7 or above.
In version 1, you needed to define the functions get/1
and get_by/1
.
Now, in version 2, you only need to define a get_by/1
function.
The following is an example get_by/1
function if you are using
Phauxth.Authenticate or Phauxth.AuthenticateToken:
def get_by(%{"session_id" => session_id}) do
Repo.get_by(User, session_id: session_id)
end
Previously, the second argument to the verify function was the user_context
module. Now, this is set in the config.
Phauxth.Confirm.verify(params, MyApp.Users)
Phauxth.Login.verify(params, MyApp.Users)
is now:
Phauxth.Confirm.verify(params) # with user_context set in the config
Phauxth.Login.verify(params)
- Phauxth.Token module now defines a behaviour which you can use to define your own token implementation
- Phauxth.Authenticate for tokens (Phauxth.Authenticate, method: :token) is now Phauxth.AuthenticateToken
- Phauxth.Authenticate does not check the session expiry value
- the session expiry value can be checked in the
get_by/1
function in the user context
- the session expiry value can be checked in the
- Phauxth.Confirm.Login has been removed
- the
crypto_module
for Phauxth.Login is now set in the config
- Phauxth.Confirm.verify with the
:pass_reset mode
has been renamed to Phauxth.Confirm.PassReset.verify
This section is only relevant if you were customizing any of the Phauxth plugs or verify functions.
- the Phauxth behaviour (used by Confirm.Base and Login.Base) now has three callbacks: verify/2, authenticate/2 and report/2
- Phauxth.Authenticate.Base
get_user
callback is nowauthenticate
, and it returns {:ok, user} or {:error, message}