Pretty things up a bit, after fixing that nasty profile bug.

This commit is contained in:
rainbow napkin 2025-11-06 19:36:52 -05:00
parent be01417cdf
commit e94914a152
2 changed files with 10 additions and 8 deletions

View file

@ -33,17 +33,14 @@ module.exports.post = async function(req, res){
const data = matchedData(req);
//make sure we're not bullshitting ourselves here.
if(user == null){
res.status(400);
return res.send('Invalid Session! Cannot delete account while logged out!');
if(user == null || user.user == null){
return errorHandler(res, 'You must be logged in to delete your account!', 'unauthorized');
}
const userDB = await userModel.findOne({user: user.user});
if(!userDB){
res.status(400);
return res.send('Invalid User! Account must exist in order to delete!');
return errorHandler(res, 'User not found!', 'unauthorized');
}
await userDB.nuke(data.pass);