Fix 3rd-party auth issues
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -69,6 +69,9 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
|
||||
{:error, :user_not_found} ->
|
||||
{:error, "No user with this email was found"}
|
||||
|
||||
{:error, :disabled_user} ->
|
||||
{:error, "This user has been disabled"}
|
||||
|
||||
{:error, _error} ->
|
||||
{:error, "Impossible to authenticate, either your email or password are invalid."}
|
||||
end
|
||||
|
||||
@@ -67,13 +67,20 @@ defmodule Mobilizon.Service.Auth.LDAPAuthenticator do
|
||||
# Then we can verify the user's password
|
||||
:ok <- bind_user(connection, base, uid_field, uid, password) do
|
||||
case fetch_user(email) do
|
||||
%User{} = user ->
|
||||
%User{disabled: false} = user ->
|
||||
user
|
||||
|
||||
%User{disabled: true} = _user ->
|
||||
{:error, :disabled_user}
|
||||
|
||||
_ ->
|
||||
register_user(email)
|
||||
end
|
||||
else
|
||||
{:error, err}
|
||||
when err in [:ldap_search_email_not_found, :ldap_search_email_not_found] ->
|
||||
{:ldap, err}
|
||||
|
||||
{:error, error} ->
|
||||
{:error, error}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user