2021-02-24 07:49:39 -05:00
|
|
|
defmodule Bones73k.Accounts.UserNotifier do
|
2021-02-24 15:52:42 -05:00
|
|
|
alias Bones73k.Mailer
|
|
|
|
alias Bones73k.Mailer.UserEmail
|
2020-09-12 20:07:02 -04:00
|
|
|
|
|
|
|
@doc """
|
|
|
|
Deliver instructions to confirm account.
|
|
|
|
"""
|
|
|
|
def deliver_confirmation_instructions(user, url) do
|
2021-02-24 15:52:42 -05:00
|
|
|
user
|
|
|
|
|> UserEmail.compose("Confirm Your Account", """
|
2020-09-12 20:07:02 -04:00
|
|
|
|
|
|
|
==============================
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
==============================
|
|
|
|
""")
|
2021-02-24 15:52:42 -05:00
|
|
|
|> Mailer.deliver_later()
|
2020-09-12 20:07:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Deliver instructions to reset a user password.
|
|
|
|
"""
|
|
|
|
def deliver_reset_password_instructions(user, url) do
|
2021-02-24 15:52:42 -05:00
|
|
|
user
|
|
|
|
|> UserEmail.compose("Reset Your Password", """
|
2020-09-12 20:07:02 -04:00
|
|
|
|
|
|
|
==============================
|
|
|
|
|
|
|
|
Hi #{user.email},
|
|
|
|
|
|
|
|
You can reset your password by visiting the URL below:
|
|
|
|
|
|
|
|
#{url}
|
|
|
|
|
|
|
|
If you didn't request this change, please ignore this.
|
|
|
|
|
|
|
|
==============================
|
|
|
|
""")
|
2021-02-24 15:52:42 -05:00
|
|
|
|> Mailer.deliver_later()
|
2020-09-12 20:07:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Deliver instructions to update a user email.
|
|
|
|
"""
|
|
|
|
def deliver_update_email_instructions(user, url) do
|
2021-02-24 15:52:42 -05:00
|
|
|
user
|
|
|
|
|> UserEmail.compose("Change Your E-mail", """
|
2020-09-12 20:07:02 -04:00
|
|
|
|
|
|
|
==============================
|
|
|
|
|
|
|
|
Hi #{user.email},
|
|
|
|
|
|
|
|
You can change your email by visiting the URL below:
|
|
|
|
|
|
|
|
#{url}
|
|
|
|
|
|
|
|
If you didn't request this change, please ignore this.
|
|
|
|
|
|
|
|
==============================
|
|
|
|
""")
|
2021-02-24 15:52:42 -05:00
|
|
|
|> Mailer.deliver_later()
|
2020-09-12 20:07:02 -04:00
|
|
|
end
|
|
|
|
end
|