Skip to content

Commit

Permalink
fixed an issue with user being lock. Now by default the locked(=false…
Browse files Browse the repository at this point in the history
…) attribute has been given to a user
  • Loading branch information
MattPlayGamez committed Oct 12, 2024
1 parent 2204f9d commit 0b9ff63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions file.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class Authenticator {
if (!userObject.loginAttempts) userObject.loginAttempts = 0
if (!userObject.locked) userObject.locked = false
if (!userObject._id) userObject._id = uuid.v4()
userObject.locked = false
userObject.emailCode = null
let returnedUser = userObject
try {
const hash = await bcrypt.hash(userObject.password, this.rounds);
Expand All @@ -115,6 +117,7 @@ class Authenticator {
userObject.password = hash;
userObject.jwt_version = 1


if (this.users.find(u => u.email === userObject.email)) return this.USER_ALREADY_EXISTS_TEXT
this.users.push(userObject);
return returnedUser;
Expand Down
2 changes: 2 additions & 0 deletions memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Authenticator {
if (!userObject.loginAttempts) userObject.loginAttempts = 0
if (!userObject.locked) userObject.locked = false
if (!userObject._id) userObject._id = uuid.v4()
userObject.locked = false
userObject.emailCode = null
let returnedUser = userObject
try {
const hash = await bcrypt.hash(userObject.password, this.rounds);
Expand Down

0 comments on commit 0b9ff63

Please sign in to comment.