Improve password reset email, make a sendwithus template for it
This commit is contained in:
parent
f1f1c23fd4
commit
61dd93917c
2 changed files with 3 additions and 7 deletions
server
|
@ -129,18 +129,13 @@ module.exports =
|
||||||
throw new errors.NotFound('not found', {property: 'email'})
|
throw new errors.NotFound('not found', {property: 'email'})
|
||||||
|
|
||||||
user.set('passwordReset', utils.getCodeCamel())
|
user.set('passwordReset', utils.getCodeCamel())
|
||||||
emailContent = "<h3>Your temporary password: <b>#{user.get('passwordReset')}</b></h3>"
|
|
||||||
emailContent += "<p>Reset your password at <a href=\"http://codecombat.com/account/settings\">http://codecombat.com/account/settings</a></p>"
|
|
||||||
emailContent += "<p>Your old password cannot be retrieved.</p>"
|
|
||||||
yield user.save()
|
yield user.save()
|
||||||
context =
|
context =
|
||||||
email_id: sendwithus.templates.generic_email
|
email_id: sendwithus.templates.password_reset
|
||||||
recipient:
|
recipient:
|
||||||
address: req.body.email
|
address: req.body.email
|
||||||
email_data:
|
email_data:
|
||||||
subject: 'CodeCombat Recovery Password'
|
tempPassword: user.get('passwordReset')
|
||||||
title: ''
|
|
||||||
content: emailContent
|
|
||||||
sendwithus.api.sendAsync = Promise.promisify(sendwithus.api.send)
|
sendwithus.api.sendAsync = Promise.promisify(sendwithus.api.send)
|
||||||
yield sendwithus.api.sendAsync(context)
|
yield sendwithus.api.sendAsync(context)
|
||||||
res.end()
|
res.end()
|
||||||
|
|
|
@ -31,3 +31,4 @@ module.exports.templates =
|
||||||
teacher_free_trial: 'tem_R7d9Hpoba9SceQNiYSXBak'
|
teacher_free_trial: 'tem_R7d9Hpoba9SceQNiYSXBak'
|
||||||
teacher_free_trial_hoc: 'tem_4ZSY9wsA9Qwn4wBFmZgPdc'
|
teacher_free_trial_hoc: 'tem_4ZSY9wsA9Qwn4wBFmZgPdc'
|
||||||
teacher_request_demo: 'tem_cwG3HZjEyb6QE493hZuUra'
|
teacher_request_demo: 'tem_cwG3HZjEyb6QE493hZuUra'
|
||||||
|
password_reset: 'tem_wbQUMRtLY9xhec8BSCykLA'
|
||||||
|
|
Reference in a new issue