-
Notifications
You must be signed in to change notification settings - Fork 402
/
mail.go
247 lines (197 loc) · 7.92 KB
/
mail.go
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information
package console
import "time"
// TrialExpirationReminderEmail is mailservice template with trial expiration reminder data.
type TrialExpirationReminderEmail struct {
Origin string
SignInLink string
ContactInfoURL string
ScheduleMeetingLink string
}
// Template returns email template name.
func (*TrialExpirationReminderEmail) Template() string { return "TrialExpirationReminder" }
// Subject gets email subject.
func (*TrialExpirationReminderEmail) Subject() string { return "Your Storj trial is ending soon" }
// TrialExpiredEmail is mailservice template with trial expiration data.
type TrialExpiredEmail struct {
Origin string
SignInLink string
ContactInfoURL string
ScheduleMeetingLink string
}
// Template returns email template name.
func (*TrialExpiredEmail) Template() string { return "TrialExpired" }
// Subject gets email subject.
func (*TrialExpiredEmail) Subject() string {
return "Your Storj trial has ended - Act now to continue!"
}
// AccountActivationEmail is mailservice template with activation data.
type AccountActivationEmail struct {
Origin string
ActivationLink string
ContactInfoURL string
TermsAndConditionsURL string
}
// Template returns email template name.
func (*AccountActivationEmail) Template() string { return "Welcome" }
// Subject gets email subject.
func (*AccountActivationEmail) Subject() string { return "Activate your email" }
// AccountActivationCodeEmail is mailservice template with activation code.
type AccountActivationCodeEmail struct {
ActivationCode string
}
// Template returns email template name.
func (*AccountActivationCodeEmail) Template() string { return "WelcomeWithCode" }
// Subject gets email subject.
func (*AccountActivationCodeEmail) Subject() string { return "Activate your email" }
// ForgotPasswordEmail is mailservice template with reset password data.
type ForgotPasswordEmail struct {
Origin string
ResetLink string
CancelPasswordRecoveryLink string
LetUsKnowURL string
ContactInfoURL string
TermsAndConditionsURL string
}
// Template returns email template name.
func (*ForgotPasswordEmail) Template() string { return "Forgot" }
// Subject gets email subject.
func (*ForgotPasswordEmail) Subject() string { return "Password recovery request" }
// ProjectInvitationEmail is mailservice template for project invitation email.
type ProjectInvitationEmail struct {
Origin string
InviterEmail string
SignInLink string
LetUsKnowURL string
ContactInfoURL string
TermsAndConditionsURL string
}
// Template returns email template name.
func (*ProjectInvitationEmail) Template() string { return "Invite" }
// Subject gets email subject.
func (email *ProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// ExistingUserProjectInvitationEmail is mailservice template for project invitation email for existing users.
type ExistingUserProjectInvitationEmail struct {
InviterEmail string
Region string
SignInLink string
}
// Template returns email template name.
func (*ExistingUserProjectInvitationEmail) Template() string { return "ExistingUserInvite" }
// Subject gets email subject.
func (email *ExistingUserProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// UnverifiedUserProjectInvitationEmail is mailservice template for project invitation email for unverified users.
type UnverifiedUserProjectInvitationEmail struct {
InviterEmail string
Region string
ActivationLink string
}
// Template returns email template name.
func (*UnverifiedUserProjectInvitationEmail) Template() string { return "UnverifiedUserInvite" }
// Subject gets email subject.
func (email *UnverifiedUserProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// NewUserProjectInvitationEmail is mailservice template for project invitation email for new users.
type NewUserProjectInvitationEmail struct {
InviterEmail string
Region string
SignUpLink string
}
// Template returns email template name.
func (*NewUserProjectInvitationEmail) Template() string { return "NewUserInvite" }
// Subject gets email subject.
func (email *NewUserProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// UnknownResetPasswordEmail is mailservice template with unknown password reset data.
type UnknownResetPasswordEmail struct {
Satellite string
Email string
DoubleCheckLink string
ResetPasswordLink string
CreateAnAccountLink string
SupportTeamLink string
}
// Template returns email template name.
func (*UnknownResetPasswordEmail) Template() string { return "UnknownReset" }
// Subject gets email subject.
func (*UnknownResetPasswordEmail) Subject() string {
return "You have requested to reset your password, but..."
}
// AccountAlreadyExistsEmail is mailservice template for email where user tries to create account, but one already exists.
type AccountAlreadyExistsEmail struct {
Origin string
SatelliteName string
SignInLink string
ResetPasswordLink string
CreateAccountLink string
}
// Template returns email template name.
func (*AccountAlreadyExistsEmail) Template() string { return "AccountAlreadyExists" }
// Subject gets email subject.
func (*AccountAlreadyExistsEmail) Subject() string {
return "Are you trying to sign in?"
}
// LockAccountActivityType is an auth activity type which led to account lock.
type LockAccountActivityType = string
const (
// LoginAccountLock represents an account lock activity type triggered by multiple failed login attempts.
LoginAccountLock LockAccountActivityType = "login"
// MfaAccountLock stands for "2fa check" and represents an account lock activity type triggered by multiple failed two-factor authentication attempts.
MfaAccountLock LockAccountActivityType = "2fa check"
)
// LoginLockAccountEmail is mailservice template with login lock account data.
type LoginLockAccountEmail struct {
LockoutDuration time.Duration
ResetPasswordLink string
ActivityType LockAccountActivityType
}
// Template returns email template name.
func (*LoginLockAccountEmail) Template() string { return "LoginLockAccount" }
// Subject gets email subject.
func (*LoginLockAccountEmail) Subject() string { return "Account Lock" }
// ActivationLockAccountEmail is mailservice template with activation lock account data.
type ActivationLockAccountEmail struct {
LockoutDuration time.Duration
SupportURL string
}
// Template returns email template name.
func (*ActivationLockAccountEmail) Template() string { return "ActivationLockAccount" }
// Subject gets email subject.
func (*ActivationLockAccountEmail) Subject() string { return "Account Lock" }
// BillingWarningEmail is an email sent to notify users of billing warning event.
type BillingWarningEmail struct {
EmailNumber int
Days int
SignInLink string
SupportLink string
}
// Template returns email template name.
func (*BillingWarningEmail) Template() string { return "BillingWarning" }
// Subject gets email subject.
func (*BillingWarningEmail) Subject() string {
return "Your payment is outstanding - Act now to continue!"
}
// BillingFreezeNotificationEmail is an email sent to notify users of account freeze event.
type BillingFreezeNotificationEmail struct {
EmailNumber int
Days int
SignInLink string
SupportLink string
}
// Template returns email template name.
func (*BillingFreezeNotificationEmail) Template() string { return "BillingFreezeNotification" }
// Subject gets email subject.
func (b *BillingFreezeNotificationEmail) Subject() string {
title := "Your account has been suspended"
if b.Days <= 0 {
title = "Your data is marked for deletion"
}
return title + " - Act now to continue!"
}