Skip to content

Commit

Permalink
Merge pull request #4 from MattPlayGamez/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
MattPlayGamez authored Sep 23, 2024
2 parents 387fae5 + e224083 commit 379ad17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion file.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class Authenticator {
const originalPush = this.users.push;
this.users.push = (...args) => {
const result = originalPush.apply(this.users, args);
console.log("database changed")
saveUsersToFile(this.users, this.DB_FILE_PATH, this.DB_PASSWORD);
return result;
};
Expand Down
4 changes: 0 additions & 4 deletions mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ class Authenticator {
if (user.locked) return "User is locked"
const result = await bcrypt.compare(password, user.password);
if (!result) {
console.log(`${user.loginAttempts} >= ${this.maxLoginAttempts}`)

if (user.loginAttempts >= this.maxLoginAttempts) {

this.lockUser(user._id);
} else {
console.log("changing login attempts")
let newAttempts = user.loginAttempts + 1
await this.changeLoginAttempts(user._id, newAttempts);
}
Expand All @@ -100,7 +98,6 @@ class Authenticator {
token: twoFactorCode,
window: 2 // Sta 2 tijdstippen toe voor en na de huidige tijd
});
console.log('Verification result:', verified);
if (!verified) return "Invalid 2FA code";

}
Expand Down Expand Up @@ -153,7 +150,6 @@ class Authenticator {
try {
if (jwt.verify(token, this.JWT_SECRET_KEY, this.JWT_OPTIONS)) {
let jwt_token = jwt.decode(token);
console.log(jwt_token)
let user = await this.getInfoFromUser(jwt_token.id)

if (user.jwt_version == jwt_token.version) {
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"name": "seamless-auth",
"version": "3.6.3",
"version": "3.6.4",
"description": "A full fledged authentication system...",
"type": "commonjs",
"main": "memory.js",
"scripts": {
"start": "node test/test.js",
"test": "npx jest --forceExit *.test.js"
},
"bugs": {
"url": "https://github.com/MattPlayGamez/auth/issues",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/MattPlayGamez/auth"
},
"extensionsToTreatAsEsm": [
".js"
],
Expand All @@ -17,7 +25,6 @@
"dependencies": {
"bcrypt": "^5.0.1",
"dotenv": "^16.4.5",
"fs": "^0.0.1-security",
"jest": "^29.7.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.6.3",
Expand Down

0 comments on commit 379ad17

Please sign in to comment.