Improve password reset email, make a sendwithus template for it

This commit is contained in:
phoenixeliot 2016-04-12 13:28:38 -07:00
parent f1f1c23fd4
commit 61dd93917c
2 changed files with 3 additions and 7 deletions

View file

@ -129,18 +129,13 @@ module.exports =
throw new errors.NotFound('not found', {property: 'email'})
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()
context =
email_id: sendwithus.templates.generic_email
email_id: sendwithus.templates.password_reset
recipient:
address: req.body.email
email_data:
subject: 'CodeCombat Recovery Password'
title: ''
content: emailContent
tempPassword: user.get('passwordReset')
sendwithus.api.sendAsync = Promise.promisify(sendwithus.api.send)
yield sendwithus.api.sendAsync(context)
res.end()

View file

@ -31,3 +31,4 @@ module.exports.templates =
teacher_free_trial: 'tem_R7d9Hpoba9SceQNiYSXBak'
teacher_free_trial_hoc: 'tem_4ZSY9wsA9Qwn4wBFmZgPdc'
teacher_request_demo: 'tem_cwG3HZjEyb6QE493hZuUra'
password_reset: 'tem_wbQUMRtLY9xhec8BSCykLA'