mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
Merge pull request from GHSA-f69g-q6v2-rhjp
* fix(api-server): only allow specified profile keys * simplify and fix validation
This commit is contained in:
@@ -146,9 +146,23 @@ function updateMyProfileUI(req, res, next) {
|
||||
user,
|
||||
body: { profileUI }
|
||||
} = req;
|
||||
|
||||
const update = {
|
||||
isLocked: !!profileUI.isLocked,
|
||||
showAbout: !!profileUI.showAbout,
|
||||
showCerts: !!profileUI.showCerts,
|
||||
showDonation: !!profileUI.showDonation,
|
||||
showHeatMap: !!profileUI.showHeatMap,
|
||||
showLocation: !!profileUI.showLocation,
|
||||
showName: !!profileUI.showName,
|
||||
showPoints: !!profileUI.showPoints,
|
||||
showPortfolio: !!profileUI.showPortfolio,
|
||||
showTimeLine: !!profileUI.showTimeLine
|
||||
};
|
||||
|
||||
user.updateAttribute(
|
||||
'profileUI',
|
||||
profileUI,
|
||||
update,
|
||||
createStandardHandler(req, res, next, 'flash.privacy-updated')
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user