Closed ichagas closed 8 years ago
This functionality is implemented in Superlogin-Demo. If you are using Angular the code is very simple...
return $http.post('/user/destroy');
And here is the Express endpoint to accomplish the above...
app.post('/user/destroy', superlogin.requireAuth, function(req, res, next) {
superlogin.removeUser(req.user._id, true)
.then(function() {
console.log('User destroyed!');
res.status(200).json({ok: true, success: 'User: ' + req.user._id + ' destroyed.'});
}, function(err) {
return next(err);
});
});
Thanks @colinskow! It worked like a charm!
Thank you very much on the work you have done and shared, it is truly powerful.
In the server side the
superlogin.removeUser()
worked OK. However, I want offer to users the option to delete their account directly from the App. This is why I need this implemented in NG-SuperloginLooking on both repositories (SuperLogin and NG-Superlogin) I couldn't found a source code that make a reference to this API, any thoughts?
Thanks!