Always lowercase the emails before trying to reset password

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-10-18 16:19:41 +02:00
parent cb083ab2f8
commit c9fffca046
2 changed files with 27 additions and 6 deletions

View File

@@ -713,7 +713,7 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do
mutation = """
mutation {
resendConfirmationEmail(
email: "oh no"
email: "oh@no.com"
)
}
"""
@@ -741,6 +741,18 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do
assert res["data"]["sendResetPassword"] == email
end
test "test send_reset_password/3 with an email with no account", %{conn: conn} do
res =
conn
|> AbsintheHelpers.graphql_query(
query: @send_reset_password_mutation,
variables: %{email: "noone@nowhere.com"}
)
assert hd(res["errors"])["message"] ==
"No user with this email was found"
end
test "test send_reset_password/3 with invalid email", %{conn: conn} do
res =
conn
@@ -750,7 +762,7 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do
)
assert hd(res["errors"])["message"] ==
"No user with this email was found"
"This email doesn't seem to be valid"
end
test "test send_reset_password/3 for an LDAP user", %{conn: conn} do