1
0
Fork 0
forked from svrjs/svrjs

Make the improvement consistent with password verification function

This commit is contained in:
Dorian Niemiec 2024-03-17 10:20:00 +01:00
parent 32a92804fa
commit c85df7cd26

12
svr.js
View file

@ -4651,10 +4651,10 @@ if (!cluster.isPrimary) {
var scryptCount = 0;
if (!authcode.userList || authcode.userList.indexOf(username) > -1) {
usernameMatch = users.filter(function (entry) {
if(entry.pbkdf2) {
pbkdf2Count++;
} else if(entry.scrypt) {
if(entry.scrypt) {
scryptCount++;
} else if(entry.pbkdf2) {
pbkdf2Count++;
} else {
sha256Count++;
}
@ -4669,10 +4669,10 @@ if (!cluster.isPrimary) {
salt: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0"
};
if (!process.isBun) {
if (pbkdf2Count > sha256Count && pbkdf2Count > scryptCount) {
fakeCredentials.pbkdf2 = true;
} else if (scryptCount > sha256Count) {
if (scryptCount > sha256Count && scryptCount > pbkdf2Count) {
fakeCredentials.scrypt = true;
} else if (pbkdf2Count > sha256Count) {
fakeCredentials.pbkdf2 = true;
}
}
usernameMatch.push(fakeCredentials);