Skip to content

Commit

Permalink
ensure forgot password link is encoded correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Apr 24, 2017
1 parent 602f46e commit 0fc01c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/code_corps/emails/forgot_password_email.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ defmodule CodeCorps.Emails.ForgotPasswordEmail do
defp template_id, do: Application.get_env(:code_corps, :postmark_forgot_password_template)

defp link(token) do
"#{token}" # TODO: we can replace this with the proper string later
Application.get_env(:code_corps, :site_url)
|> URI.merge("password/reset?token=#{token}")
|> URI.to_string
end
end
2 changes: 2 additions & 0 deletions test/lib/code_corps/emails/forgot_password_email_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ defmodule CodeCorps.Emails.ForgotPasswordEmailTest do
email = ForgotPasswordEmail.create(user, token)
assert email.from == "Code Corps<team@codecorps.org>"
assert email.to == user.email
{ :link, encoded_link } = email.private.template_model |> Enum.at(0)
assert "#{Application.get_env(:code_corps, :site_url)}/password/reset?token=#{token}" == encoded_link
end
end

0 comments on commit 0fc01c3

Please sign in to comment.