This commit is contained in:
Julian Lam
2018-04-02 12:29:22 -04:00
parent 9641ada53c
commit 113fed05d8
3 changed files with 40 additions and 10 deletions

View File

@@ -103,6 +103,13 @@ module.exports = function (SocketUser) {
], callback);
}
SocketUser.checkPassword = function (socket, data, callback) {
isPrivilegedOrSelfAndPasswordMatch(socket.uid, data, function (err) {
// Return a bool (without delayed response to prevent brute-force checking of password validity)
setTimeout(callback.bind(null, null, !err), 1000);
});
};
SocketUser.changePassword = function (socket, data, callback) {
if (!socket.uid) {
return callback(new Error('[[error:invalid-uid]]'));