Skip to content

Commit

Permalink
fix: remove logged count
Browse files Browse the repository at this point in the history
  • Loading branch information
arteevraina committed Dec 12, 2023
1 parent 711aa06 commit dbb9a3a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions backend/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def login():
if not user["isverified"] and is_ci!='true': # TODO: Uncomment this line to enable email verification
return jsonify({"message": "Please verify your email", "code": 401}), 401

user["loggedCount"] += 1

access_token = create_access_token(identity=user["uuid"])
refresh_token = create_refresh_token(identity=user["uuid"])

Expand All @@ -76,7 +74,6 @@ def login():
{
"$set": {
"loginAt": datetime.utcnow(),
"loggedCount": user["loggedCount"],
}
},
)
Expand Down Expand Up @@ -132,7 +129,6 @@ def signup():
"loginAt": datetime.utcnow(),
"createdAt": datetime.utcnow(),
"uuid": uuid,
"loggedCount": 1,
"isverified": False,
"newemail":'',
}
Expand Down Expand Up @@ -176,14 +172,11 @@ def logout():
if not user:
return jsonify({"message": "User not found", "code": 404})

user["loggedCount"] -= 1

db.users.update_one(
{"_id": user["_id"]},
{
"$set": {
"lastLogout": datetime.utcnow(),
"loggedCount": user["loggedCount"],
}
},
)
Expand Down Expand Up @@ -244,7 +237,7 @@ def forgot_password(*email):
return jsonify({"message": "Please verify your email", "code": 401}), 401

uuid = generate_uuid()
db.users.update_one({"email": email}, {"$set": {"uuid": uuid, "loggedCount": 1}})
db.users.update_one({"email": email}, {"$set": {"uuid": uuid}})

message = f"""\n
Dear {user['username']},
Expand Down

0 comments on commit dbb9a3a

Please sign in to comment.