mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 17:46:16 +01:00
check password validity in user delete socket call
This commit is contained in:
@@ -36,6 +36,11 @@ SocketUser.deleteAccount = function (socket, data, callback) {
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
user.isPasswordCorrect(socket.uid, data.password, function (err, ok) {
|
||||
next(err || !ok ? new Error('[[error:invalid-password]]') : undefined);
|
||||
});
|
||||
},
|
||||
function (next) {
|
||||
user.isAdministrator(socket.uid, next);
|
||||
},
|
||||
@@ -56,7 +61,15 @@ SocketUser.deleteAccount = function (socket, data, callback) {
|
||||
});
|
||||
next();
|
||||
},
|
||||
], callback);
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return setTimeout(function () {
|
||||
callback(err);
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
SocketUser.emailExists = function (socket, data, callback) {
|
||||
|
||||
Reference in New Issue
Block a user