From 5765c18defc6a2ef1fc761904c98ecba1fea5caa Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Tue, 13 Jan 2015 00:35:11 -0500 Subject: [PATCH 1/2] Re-enabling password reset for email signups --- controllers/user.js | 6 +++--- views/account/reset.jade | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/user.js b/controllers/user.js index bc46b8553f..f780c41b6c 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -581,9 +581,9 @@ exports.postForgot = function(req, res, next) { from: 'Team@freecodecamp.com', subject: 'Reset your Free Code Camp password', text: [ - 'You are receiving this email because you (or someone else)', + 'You are receiving this email because you (or someone else)\n', 'requested we reset your Free Code Camp account\'s password.\n\n', - 'Please click on the following link, or paste this into your', + 'Please click on the following link, or paste this into your\n', 'browser to complete the process:\n\n', 'http://', req.headers.host, @@ -592,7 +592,7 @@ exports.postForgot = function(req, res, next) { '\n\n', 'If you did not request this, please ignore this email and', 'your password will remain unchanged.\n' - ].join(' ') + ].join('') }; transporter.sendMail(mailOptions, function(err) { if (err) { return done(err); } diff --git a/views/account/reset.jade b/views/account/reset.jade index ac5e88584b..fab364d654 100644 --- a/views/account/reset.jade +++ b/views/account/reset.jade @@ -2,7 +2,7 @@ extends ../layout block content .col-sm-8.col-sm-offset-2 - form(method='POST') + form(action='/post/reset/', method='POST') legend Reset Password input(type='hidden', name='_csrf', value=_csrf) .form-group From 26c3f265ad0d123a8fce552b9355e6e1f6306138 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 12 Jan 2015 22:02:33 -0800 Subject: [PATCH 2/2] update the reset password functionality and make the password reset form consistent with other such forms --- controllers/user.js | 5 +++-- views/account/reset.jade | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/controllers/user.js b/controllers/user.js index f780c41b6c..97ea084550 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -428,7 +428,8 @@ exports.getReset = function(req, res) { return res.redirect('/forgot'); } res.render('account/reset', { - title: 'Password Reset' + title: 'Password Reset', + token: req.params.token }); }); }; @@ -590,7 +591,7 @@ exports.postForgot = function(req, res, next) { '/reset/', token, '\n\n', - 'If you did not request this, please ignore this email and', + 'If you did not request this, please ignore this email and\n', 'your password will remain unchanged.\n' ].join('') }; diff --git a/views/account/reset.jade b/views/account/reset.jade index fab364d654..cfea79e93f 100644 --- a/views/account/reset.jade +++ b/views/account/reset.jade @@ -1,9 +1,9 @@ extends ../layout block content - .col-sm-8.col-sm-offset-2 - form(action='/post/reset/', method='POST') - legend Reset Password + .col-sm-8.col-sm-offset-2.jumbotron + form(action='/reset/#{token}', method='POST') + h1 Reset Password input(type='hidden', name='_csrf', value=_csrf) .form-group label(for='password') New Password