add a way for admins to set username when profiles are locked

This commit is contained in:
Girish Ramakrishnan
2022-01-12 16:20:10 -08:00
parent ded5db20e6
commit 4513b6de70
3 changed files with 3 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ async function update(req, res, next) {
assert.strictEqual(typeof req.user, 'object');
assert.strictEqual(typeof req.body, 'object');
if ('username' in req.body && typeof req.body.username !== 'string') return next(new HttpError(400, 'username must be string')); // when profile are locked, admin can set username
if ('email' in req.body && typeof req.body.email !== 'string') return next(new HttpError(400, 'email must be string'));
if ('fallbackEmail' in req.body && typeof req.body.fallbackEmail !== 'string') return next(new HttpError(400, 'fallbackEmail must be string'));
if ('displayName' in req.body && typeof req.body.displayName !== 'string') return next(new HttpError(400, 'displayName must be string'));