remove old password reset route
This commit is contained in:
@ -67,7 +67,6 @@ module.exports = function(app) {
|
|||||||
router.get('/email-signup', getEmailSignup);
|
router.get('/email-signup', getEmailSignup);
|
||||||
router.get('/email-signin', getEmailSignin);
|
router.get('/email-signin', getEmailSignin);
|
||||||
router.get('/account/api', getAccountAngular);
|
router.get('/account/api', getAccountAngular);
|
||||||
router.post('/account/password', postUpdatePassword);
|
|
||||||
router.post('/account/delete', postDeleteAccount);
|
router.post('/account/delete', postDeleteAccount);
|
||||||
router.get('/account/unlink/:provider', getOauthUnlink);
|
router.get('/account/unlink/:provider', getOauthUnlink);
|
||||||
router.get('/account', getAccount);
|
router.get('/account', getAccount);
|
||||||
@ -207,34 +206,6 @@ module.exports = function(app) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function postUpdatePassword(req, res, next) {
|
|
||||||
req.assert('password', 'Password must be at least 4 characters long')
|
|
||||||
.len(4);
|
|
||||||
|
|
||||||
req.assert('confirmPassword', 'Passwords do not match')
|
|
||||||
.equals(req.body.password);
|
|
||||||
|
|
||||||
var errors = req.validationErrors();
|
|
||||||
|
|
||||||
if (errors) {
|
|
||||||
req.flash('errors', errors);
|
|
||||||
return res.redirect('/account');
|
|
||||||
}
|
|
||||||
|
|
||||||
User.findById(req.user.id, function(err, user) {
|
|
||||||
if (err) { return next(err); }
|
|
||||||
|
|
||||||
user.password = req.body.password;
|
|
||||||
|
|
||||||
user.save(function(err) {
|
|
||||||
if (err) { return next(err); }
|
|
||||||
|
|
||||||
req.flash('success', { msg: 'Password has been changed.' });
|
|
||||||
res.redirect('/account');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function postDeleteAccount(req, res, next) {
|
function postDeleteAccount(req, res, next) {
|
||||||
User.destroyById(req.user.id, function(err) {
|
User.destroyById(req.user.id, function(err) {
|
||||||
if (err) { return next(err); }
|
if (err) { return next(err); }
|
||||||
|
Reference in New Issue
Block a user