mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
breaking: remove socket.emit('user.changeUsernameEmail')
remove socket.emit('user.changePassword')
remove socket.emit('user.updateProfile')
This commit is contained in:
@@ -44,7 +44,7 @@ usersAPI.update = async function (caller, data) {
|
||||
]);
|
||||
|
||||
// Changing own email/username requires password confirmation
|
||||
if (['email', 'username'].some(prop => Object.keys(data).includes(prop))) {
|
||||
if (data.hasOwnProperty('email') || data.hasOwnProperty('username')) {
|
||||
await isPrivilegedOrSelfAndPasswordMatch(caller, data);
|
||||
}
|
||||
|
||||
@@ -63,16 +63,15 @@ usersAPI.update = async function (caller, data) {
|
||||
await user.updateProfile(caller.uid, data);
|
||||
const userData = await user.getUserData(data.uid);
|
||||
|
||||
async function log(type, eventData) {
|
||||
eventData.type = type;
|
||||
eventData.uid = caller.uid;
|
||||
eventData.targetUid = data.uid;
|
||||
eventData.ip = caller.ip;
|
||||
await events.log(eventData);
|
||||
}
|
||||
|
||||
if (userData.username !== oldUserData.username) {
|
||||
await log('username-change', { oldUsername: oldUserData.username, newUsername: userData.username });
|
||||
await events.log({
|
||||
type: 'username-change',
|
||||
uid: caller.uid,
|
||||
targetUid: data.uid,
|
||||
ip: caller.ip,
|
||||
oldUsername: oldUserData.username,
|
||||
newUsername: userData.username,
|
||||
});
|
||||
}
|
||||
return userData;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user