Fix registering new user account with same email as unconfirmed

Refactors get_user_by_email/2

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-03-25 10:22:40 +01:00
parent e6189390ac
commit 95516a4067
7 changed files with 121 additions and 84 deletions

View File

@@ -86,7 +86,7 @@ defmodule Mobilizon.Service.Auth.Authenticator do
def fetch_user(nil), do: {:error, :user_not_found}
def fetch_user(email) when not is_nil(email) do
with {:ok, %User{} = user} <- Users.get_user_by_email(email, true) do
with {:ok, %User{} = user} <- Users.get_user_by_email(email, activated: true) do
user
end
end