Last active
May 25, 2016 01:00
-
-
Save KieronWiltshire/69bd1876763470063dceb92887403136 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Send the specified user their email verification token | |
* @param {Object} options | |
* @returns {Promise<>} | |
*/ | |
self.sendEmailVerificationToken = function(options) { | |
return new Promise(function(resolve, reject) { | |
self.find(options).then(function(user) { | |
return mailer('email.user.email-verification', { | |
'to': user.email, | |
'subject': 'Email verification', | |
'context': { | |
'user': user, | |
'token': user.emailToken | |
} | |
}).then(function() { | |
self.emit('sendEmailVerificationToken', {'user': user}); | |
resolve(); | |
}); | |
}).catch(reject); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment