@ -47,13 +47,14 @@ router.post('/recover', parseJSON, validate.validEmail('email'), async (req, res
if(user)
email.sendPasswordReset(user)
else
email.sendNoSuchAccount(req.body.email)
res.end()
})
router.post('/recover/password', parseJSON,
validate.validPassword('password'),
validate.bothPasswordsMatch, async (req, res) => {
const {password, link_uuid, link_key} = req.body
@ -31,5 +31,18 @@ email.sendPasswordReset = async user => {
}
await sendgrid.send(msg)
email.sendNoSuchAccount = async email => {
const msg = {
to: email,
from: {email: 'accounts@email.societyofsocks.us', name: 'Society of Socks'},
templateId: 'd-34bb8b2a94264092a47d1f03999be836',
dynamic_template_data: {
emailAddress: email