fix(user): Remove remote method on user create
This commit is contained in:
@ -164,47 +164,6 @@ module.exports = function(User) {
|
||||
});
|
||||
});
|
||||
|
||||
// send welcome email to new camper
|
||||
User.afterRemote('create', function({ req, res }, user, next) {
|
||||
debug('user created, sending email');
|
||||
if (!user.email || !isEmail(user.email)) { return next(); }
|
||||
const redirect = req.session && req.session.returnTo ?
|
||||
req.session.returnTo :
|
||||
'/';
|
||||
|
||||
var mailOptions = {
|
||||
type: 'email',
|
||||
to: user.email,
|
||||
from: getEmailSender(),
|
||||
subject: 'Welcome to freeCodeCamp!',
|
||||
protocol: getProtocol(),
|
||||
host: getHost(),
|
||||
port: getPort(),
|
||||
template: path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'server',
|
||||
'views',
|
||||
'emails',
|
||||
'a-extend-user-welcome.ejs'
|
||||
),
|
||||
redirect: '/email-signin'
|
||||
};
|
||||
|
||||
debug('sending welcome email');
|
||||
return user.verify(mailOptions, function(err) {
|
||||
if (err) { return next(err); }
|
||||
req.flash('success', {
|
||||
msg: [ 'Congratulations ! We\'ve created your account. ',
|
||||
'Please check your email. We sent you a link that you can ',
|
||||
'click to verify your email address and then login.'
|
||||
].join('')
|
||||
});
|
||||
return res.redirect(redirect);
|
||||
});
|
||||
});
|
||||
|
||||
User.observe('before save', function({ instance: user }, next) {
|
||||
if (user) {
|
||||
// Some old accounts will not have emails associated with theme
|
||||
|
@ -1,19 +0,0 @@
|
||||
Greetings from San Francisco!
|
||||
|
||||
Thank you for joining our community.
|
||||
|
||||
Please verify your email by following the link below:
|
||||
|
||||
<a href="<%= verifyHref %>"><%= verifyHref %></a>
|
||||
|
||||
Feel free to email us at this address if you have any questions about freeCodeCamp.
|
||||
<br>
|
||||
<br>
|
||||
And if you have a moment, check out our blog: https://medium.freecodecamp.org.
|
||||
<br>
|
||||
<br>
|
||||
Good luck with the challenges!
|
||||
|
||||
Thanks,
|
||||
The freeCodeCamp Team.
|
||||
team@freecodecamp.com
|
Reference in New Issue
Block a user