Skip to content

Instantly share code, notes, and snippets.

@KieronWiltshire
Last active May 25, 2016 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KieronWiltshire/69bd1876763470063dceb92887403136 to your computer and use it in GitHub Desktop.
Save KieronWiltshire/69bd1876763470063dceb92887403136 to your computer and use it in GitHub Desktop.
/**
* 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