[bug] Fix login attempts to disabled users

This commit is contained in:
Cohee
2024-10-09 01:54:56 +03:00
parent 07d6808e4e
commit 0ada5407ee
2 changed files with 4 additions and 4 deletions

View File

@ -36,12 +36,12 @@ const basicAuthMiddleware = async function (request, response, callback) {
} else if (PER_USER_BASIC_AUTH) {
const userHandles = await getAllUserHandles();
for (const userHandle of userHandles) {
if (username == userHandle) {
if (username === userHandle) {
const user = await storage.getItem(toKey(userHandle));
if (user && (user.password && user.password === getPasswordHash(password, user.salt))) {
if (user && user.enabled && (user.password && user.password === getPasswordHash(password, user.salt))) {
return callback();
}
else if (user && !user.password && !password) {
else if (user && user.enabled && !user.password && !password) {
// Login to an account without password
return callback();
}