mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
* comment out begin with basics until lessons are on the way * route to footer link dead views * proposed >7 piece engame processing * basic privacy and terms pages with default text * add branding to config and reference across the site * disclose guest puzzle limit in privacy policy (#87)
81 lines
1.7 KiB
Elixir
81 lines
1.7 KiB
Elixir
defmodule Chesstrainer.Accounts.UserNotifier do
|
|
import Swoosh.Email
|
|
|
|
alias Chesstrainer.Branding
|
|
alias Chesstrainer.Mailer
|
|
|
|
# Delivers the email using the application mailer.
|
|
defp deliver(recipient, subject, body) do
|
|
email =
|
|
new()
|
|
|> to(recipient)
|
|
|> from({Branding.name(), Branding.support_email()})
|
|
|> subject(subject)
|
|
|> text_body(body)
|
|
|
|
with {:ok, _metadata} <- Mailer.deliver(email) do
|
|
{:ok, email}
|
|
end
|
|
end
|
|
|
|
@doc """
|
|
Deliver instructions to confirm account.
|
|
"""
|
|
def deliver_confirmation_instructions(user, url) do
|
|
deliver(user.email, "Confirmation instructions", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.email},
|
|
|
|
You can confirm your account by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you didn't create an account with us, please ignore this.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
|
|
@doc """
|
|
Deliver instructions to reset a user password.
|
|
"""
|
|
def deliver_reset_password_instructions(user, url) do
|
|
deliver(user.email, "Reset password instructions", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.email},
|
|
|
|
You can reset your password by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you didn't request this change, please ignore this.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
|
|
@doc """
|
|
Deliver instructions to update a user email.
|
|
"""
|
|
def deliver_update_email_instructions(user, url) do
|
|
deliver(user.email, "Update email instructions", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.email},
|
|
|
|
You can change your email by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you didn't request this change, please ignore this.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
end
|