Merge pull request #10432 from BerkeleyTrue/fix/add-delete-page

Fix(settings): Add separate delete page
This commit is contained in:
Quincy Larson
2016-09-03 18:04:42 -07:00
committed by GitHub
7 changed files with 51 additions and 113 deletions

View File

@@ -168,6 +168,11 @@ module.exports = function(app) {
router.get('/email-signin', getEmailSignin);
router.get('/deprecated-signin', getDepSignin);
router.get('/update-email', getUpdateEmail);
router.get(
'/delete-my-account',
sendNonUserToMap,
showDelete
);
api.post(
'/account/delete',
ifNoUser401,
@@ -432,6 +437,10 @@ module.exports = function(app) {
);
}
function showDelete(req, res) {
return res.render('account/delete', { title: 'Delete My Account!' });
}
function postDeleteAccount(req, res, next) {
User.destroyById(req.user.id, function(err) {
if (err) { return next(err); }