fix(back): Improve error message when requesting reset passwords and new instructions

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-17 09:46:50 +02:00
parent 73eb4603b1
commit 1c1d0d47d7
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 11 additions and 3 deletions

View file

@ -303,7 +303,11 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
{:error, dgettext("errors", "This email doesn't seem to be valid")} {:error, dgettext("errors", "This email doesn't seem to be valid")}
{:error, :email_too_soon} -> {:error, :email_too_soon} ->
{:error, dgettext("errors", "You requested again a confirmation email too soon")} {:error,
dgettext(
"errors",
"You requested again a confirmation email too soon. Please try again in a few minutes"
)}
end end
end end
@ -330,7 +334,11 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
{:error, dgettext("errors", "No user with this email was found")} {:error, dgettext("errors", "No user with this email was found")}
{:error, :email_too_soon} -> {:error, :email_too_soon} ->
{:error, dgettext("errors", "You requested again a confirmation email too soon")} {:error,
dgettext(
"errors",
"You requested again a password reset email too soon. Please try again in a few minutes"
)}
end end
end end

View file

@ -694,7 +694,7 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation)) |> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert hd(json_response(res, 200)["errors"])["message"] == assert hd(json_response(res, 200)["errors"])["message"] ==
"You requested again a confirmation email too soon" "You requested again a confirmation email too soon. Please try again in a few minutes"
# Hammer time ! # Hammer time !
Users.update_user(user, %{ Users.update_user(user, %{