This repository has been archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
/
notifier.ex
73 lines (52 loc) · 1.72 KB
/
notifier.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
defmodule <%= inspect context.module %>.<%= inspect schema.alias %>Notifier do
# For simplicity, this module simply logs messages to the terminal.
# You should replace it by a proper email or notification tool, such as:
#
# * Swoosh - https://hexdocs.pm/swoosh
# * Bamboo - https://hexdocs.pm/bamboo
#
defp deliver(to, body) do
require Logger
Logger.debug(body)
{:ok, %{to: to, body: body}}
end
@doc """
Deliver instructions to confirm account.
"""
def deliver_confirmation_instructions(<%= schema.singular %>, url) do
deliver(<%= schema.singular %>.email, """
==============================
Hi #{<%= schema.singular %>.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 password account.
"""
def deliver_reset_password_instructions(<%= schema.singular %>, url) do
deliver(<%= schema.singular %>.email, """
==============================
Hi #{<%= schema.singular %>.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 your email.
"""
def deliver_update_email_instructions(<%= schema.singular %>, url) do
deliver(<%= schema.singular %>.email, """
==============================
Hi #{<%= schema.singular %>.email},
You can change your email by visiting the url below:
#{url}
If you didn't request this change, please ignore this.
==============================
""")
end
end