Fixed #83
parent
27af445e6f
commit
e23c00f41c
|
@ -166,11 +166,10 @@ router.route('/')
|
|||
res.redirect('/settings');
|
||||
});
|
||||
|
||||
} )
|
||||
|
||||
// Delete user account
|
||||
.delete( (req,res,next)=>{
|
||||
} );
|
||||
|
||||
// Delete account
|
||||
router.get('/delete', (req,res)=>{
|
||||
User.findByIdAndRemove(req.user)
|
||||
.then( ()=>{
|
||||
req.flash('success', 'Your account has been deleted. ');
|
||||
|
@ -180,7 +179,6 @@ router.route('/')
|
|||
mw.throwErr(err,req);
|
||||
res.redirect('/settings');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Confirm email address
|
||||
|
|
|
@ -26,16 +26,7 @@ $(function(){
|
|||
// Delete account
|
||||
$('#delete').click(function(){
|
||||
if (confirm("Are you sure you want to delete your account? This CANNOT be undone! ")) {
|
||||
$.ajax({
|
||||
url: '/settings',
|
||||
type: 'DELETE',
|
||||
success: function(){
|
||||
location.reload();
|
||||
},
|
||||
fail: function(){
|
||||
alert("Failed to delete account!");
|
||||
}
|
||||
});
|
||||
window.location.href = "/settings/delete";
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue