mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 05:54:25 -04:00
account switch – extra protection for editor
This commit is contained in:
parent
04ed4aaebb
commit
73ab63447b
@ -452,6 +452,8 @@
|
||||
this.saving = true;
|
||||
try {
|
||||
await this.$post(`/profile/save`, {
|
||||
username: this.$user().username,
|
||||
|
||||
opinions: this.opinions,
|
||||
names: this.names,
|
||||
pronouns: this.pronouns,
|
||||
|
@ -526,6 +526,10 @@ router.post('/profile/save', handleErrorAsync(async (req, res) => {
|
||||
return res.status(401).json({error: 'Unauthorised'});
|
||||
}
|
||||
|
||||
if (req.body.username && req.user.username !== req.body.username) {
|
||||
return res.status(401).json({error: 'Payload username does not match the token'});
|
||||
}
|
||||
|
||||
if (!Array.isArray(req.body.names)) {
|
||||
// service worker cache sends v1 requests
|
||||
req.body = upgradeToV2(req.body);
|
||||
|
Loading…
x
Reference in New Issue
Block a user