-
Notifications
You must be signed in to change notification settings - Fork 192
/
entry.coffee
36 lines (30 loc) · 1.16 KB
/
entry.coffee
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
Meteor.startup ->
Accounts.urls.resetPassword = (token) ->
Meteor.absoluteUrl('reset-password/' + token)
Accounts.urls.enrollAccount = (token) ->
Meteor.absoluteUrl('enroll-account/' + token)
AccountsEntry =
settings: {}
config: (appConfig) ->
@settings = _.extend(@settings, appConfig)
@AccountsEntry = AccountsEntry
Meteor.methods
entryValidateSignupCode: (signupCode) ->
check signupCode, Match.OneOf(String, null, undefined)
not AccountsEntry.settings.signupCode or signupCode is AccountsEntry.settings.signupCode
entryCreateUser: (user) ->
check user, Object
profile = AccountsEntry.settings.defaultProfile || {}
if user.username
userId = Accounts.createUser
username: user.username,
email: user.email,
password: user.password,
profile: _.extend(profile, user.profile)
else
userId = Accounts.createUser
email: user.email
password: user.password
profile: _.extend(profile, user.profile)
if (user.email && Accounts._options.sendVerificationEmail)
Accounts.sendVerificationEmail(userId, user.email)