Skip to content

Instantly share code, notes, and snippets.

@wttj-tech
Created March 28, 2022 08:34
Show Gist options
  • Save wttj-tech/a2e8ea4dcfa9e0ed999dd14e11a253f8 to your computer and use it in GitHub Desktop.
Save wttj-tech/a2e8ea4dcfa9e0ed999dd14e11a253f8 to your computer and use it in GitHub Desktop.
Impartial response
def create(conn, %{"user" => %{"email" => email}}) do
if user = Accounts.get_user_by_email(email) do
Accounts.deliver_user_reset_password_instructions(
user,
&Routes.user_reset_password_url(conn, :edit, &1)
)
end
# In order to prevent user enumeration attacks, regardless of the outcome, show an impartial success/error message.
conn
|> put_flash(
:info,
"If your email is in our system, you will receive instructions to reset your password shortly."
)
|> redirect(to: "/")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment