-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
62 lines (55 loc) · 1.66 KB
/
Copy pathserver.js
File metadata and controls
62 lines (55 loc) · 1.66 KB
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
import { Meteor } from 'meteor/meteor'
import { Accounts } from 'meteor/accounts-base'
import { RegisterEmail, GenerateEmail } from 'meteor/lef:systemmailing'
Accounts.urls.resetPassword = token => {
return Meteor.absoluteUrl('reset-password/' + token)
}
RegisterEmail({
_id: 'resetPassword',
params: {
firstname: 'user.profile.firstname',
lastname: 'user.profile.lastname',
url: 'url'
}
})
RegisterEmail({
_id: 'verifyEmail',
params: {
firstname: 'user.profile.firstname',
lastname: 'user.profile.lastname',
url: 'url'
}
})
const resetPasswordMail = ({ profile }) => {
const { language } = profile
return new GenerateEmail({ _id: 'resetPassword', language })
}
const verifyEmailMail = ({ profile }) => {
const { language } = profile
return new GenerateEmail({ _id: 'verifyEmail', language })
}
const appUrl = Meteor.settings.public.url
Accounts.emailTemplates = {
resetPassword: {
from: () => resetPasswordMail({ profile: { language: 'en' } }).from(),
subject: user => resetPasswordMail(user).subject({ user }),
html: (user, url) => {
if (appUrl) {
const urlArray = url.split('/')
url = appUrl + '/reset-password/' + urlArray[urlArray.length - 1]
}
return resetPasswordMail(user).html({ user, url })
}
},
verifyEmail: {
from: () => verifyEmailMail({ profile: { language: 'en' } }).from(),
subject: user => verifyEmailMail(user).subject({ user }),
html: (user, url) => {
if (appUrl) {
const urlArray = url.split('/')
url = appUrl + '/verify-email/' + urlArray[urlArray.length - 1]
}
return verifyEmailMail(user).html({ user, url })
}
}
}