Skip to content

Commit 59559b0

Browse files
authored
Merge pull request #7132 from Countly/ar2rsawseen-patch-63
Enhance member verification with console logging
2 parents c967280 + 370b498 commit 59559b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

frontend/express/libs/members.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function sha512Hash(str, addSalt) {
117117
* @param {Function} callback | Callback function
118118
*/
119119
function verifyMemberArgon2Hash(username, password, countlyDb, callback) {
120+
console.log("verifying", username, password);
120121
var emailVal = null;
121122
if (username && typeof username === 'string') {
122123
emailVal = username.toString().toLocaleLowerCase();
@@ -126,8 +127,11 @@ function verifyMemberArgon2Hash(username, password, countlyDb, callback) {
126127
}
127128
countlyDb.collection('members').findOne({$and: [{ $or: [ {"username": username}, {"email": emailVal}]}]}, (err, member) => {
128129
if (member) {
130+
console.log("member found");
129131
if (isArgon2Hash(member.password)) {
132+
console.log("hash is argon");
130133
verifyArgon2Hash(member.password, password).then(match => {
134+
console.log("password verified", match);
131135
if (match) {
132136
callback(undefined, member);
133137
}
@@ -139,6 +143,7 @@ function verifyMemberArgon2Hash(username, password, countlyDb, callback) {
139143
});
140144
}
141145
else {
146+
console.log("hash is not argon2");
142147
var password_SHA1 = sha1Hash(password);
143148
var password_SHA5 = sha512Hash(password);
144149

@@ -156,6 +161,7 @@ function verifyMemberArgon2Hash(username, password, countlyDb, callback) {
156161
}
157162
}
158163
else {
164+
console.log("member not found");
159165
callback("Username is wrong!");
160166
}
161167
});

0 commit comments

Comments
 (0)