Gave profile page a facelift in perperation for email/password update pop-ups.

This commit is contained in:
rainbow napkin 2024-12-31 06:50:34 -05:00
parent a51152a89d
commit c32f3df3f3
16 changed files with 316 additions and 157 deletions

View file

@ -27,6 +27,7 @@ module.exports.post = async function(req, res){
const data = matchedData(req);
var tempResult = [];
//This is gross and quite honestly password changes should be their own endpoint anyways
//if we're not chaning the password
if(data.passChange == null){
//go through validation errors
@ -48,6 +49,7 @@ module.exports.post = async function(req, res){
const userDB = await userModel.findOne(user);
const update = {};
if(userDB){
if(data.img){
userDB.img = data.img;
@ -64,6 +66,15 @@ module.exports.post = async function(req, res){
update.signature = data.signature;
}
if(data.pronouns != null){
userDB.pronouns = data.pronouns;
if(data.pronouns == ''){
update.pronouns = "Unset/Hidden";
}else{
update.pronouns = data.pronouns;
}
}
if(data.passChange){
//kill active session to prevent connect-mongo from freaking out
accountUtils.killSession(req.session);