Skip to content

Commit

Permalink
Fixes issue #54
Browse files Browse the repository at this point in the history
  • Loading branch information
britton-jb committed Nov 3, 2017
1 parent 46ffa51 commit e65c2da
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions lib/sentinel/ueberauthenticator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,44 @@ defmodule Sentinel.Ueberauthenticator do
authenticate(user, db_auth, password)
end
end
def ueberauthenticate(%Auth{provider: :identity, uid: uid, credentials: %Auth.Credentials{other: %{password: password, password_confirmation: password}}}) do
def ueberauthenticate(
%Auth{
provider: :identity,
uid: uid,
credentials: %Auth.Credentials{
other: %{
password: password,
password_confirmation: password
}
}
}) do
Config.user_model
|> Config.repo.get_by(email: String.downcase(uid))
|> find_auth_and_authenticate(password)
end
def ueberauthenticate(%Auth{provider: :identity, uid: _uid, credentials: %Auth.Credentials{other: %{password: _password, password_confirmation: _password_confirmation}}}) do
def ueberauthenticate(
%Auth{
provider: :identity,
uid: _uid,
credentials: %Auth.Credentials{
other: %{
password: _password,
password_confirmation: _password_confirmatio
}
}
}) do
{:error, [%{password: "Password must match password confirmation"}]}
end
def ueberauthenticate(%Auth{provider: :identity, uid: uid, credentials: %Auth.Credentials{other: %{password: password}}}) do
def ueberauthenticate(
%Auth{
provider: :identity,
uid: uid,
credentials: %Auth.Credentials{
other: %{
password: password
}
}
}) do
Config.user_model
|> Config.repo.get_by(email: String.downcase(uid))
|> find_auth_and_authenticate(password)
Expand Down

0 comments on commit e65c2da

Please sign in to comment.