The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/server/methods/sendConfirmationEmail.js

37 lines
1015 B

Meteor.methods({
sendConfirmationEmail(email) {
check(email, String);
email = email.trim();
const user = RocketChat.models.Users.findOneByEmailAddress(email);
if (user) {
if (RocketChat.settings.get('Verification_Customized')) {
const subject = RocketChat.placeholders.replace(RocketChat.settings.get('Verification_Email_Subject') || '');
const html = RocketChat.placeholders.replace(RocketChat.settings.get('Verification_Email') || '');
Accounts.emailTemplates.verifyEmail.subject = function(/* userModel*/) {
return subject;
};
Accounts.emailTemplates.verifyEmail.html = function(userModel, url) {
return html.replace(/\[Verification_Url]/g, url);
};
}
try {
Accounts.sendVerificationEmail(user._id, email);
} catch (error) {
throw new Meteor.Error('error-email-send-failed', `Error trying to send email: ${ error.message }`, {
method: 'registerUser',
message: error.message,
});
}
return true;
}
return false;
},
});