refactor: socket profile update to use api lib

This commit is contained in:
Julian Lam
2020-10-15 16:21:45 -04:00
parent d69e503d21
commit 31ae8a8323
3 changed files with 4 additions and 53 deletions

View File

@@ -27,7 +27,7 @@ usersAPI.update = async function (caller, data) {
]);
// Changing own email/username requires password confirmation
if (caller.uid === targetUid && !passwordMatch) {
if (['email', 'username'].some(prop => Object.keys(data).includes(prop)) && !isAdminOrGlobalMod && caller.uid === targetUid && !passwordMatch) {
throw new Error('[[error:invalid-password]]');
}