mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-10-29 18:54:34 +08:00
Merge pull request #10432 from BerkeleyTrue/fix/add-delete-page
Fix(settings): Add separate delete page
This commit is contained in:
@@ -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); }
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
extends ../layout
|
||||
block content
|
||||
include ../partials/flyer
|
||||
#modal-dialog.modal.animated.wobble
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
a.close(href='/about', data-dismiss='modal', aria-hidden='true') ×
|
||||
h3 You don't really want to delete your account, do you?
|
||||
.modal-body
|
||||
p This will really delete all your data, including all your progress and brownie points.
|
||||
p We won't be able to recover any of it for you later, even if you change your mind.
|
||||
p If there's something we could do better, send us an email instead and we'll do our best:  
|
||||
a(href="mailto:team@freecodecamp.com") team@freecodecamp.com
|
||||
| .
|
||||
.modal-footer
|
||||
a.btn.btn-success.btn-block(href='/about', data-dismiss='modal', aria-hidden='true')
|
||||
| Nevermind, I don't want to delete all of my progress
|
||||
.spacer
|
||||
form(action='/account/delete', method='POST')
|
||||
input(type='hidden', name='_csrf', value=_csrf)
|
||||
button.btn.btn-danger.btn-block(type='submit')
|
||||
| I am 100% sure I want to delete my account and all of my progress
|
||||
script.
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const modal$ = document.getElementById('modal-dialog');
|
||||
modal$.classList.add('show');
|
||||
});
|
||||
Reference in New Issue
Block a user