Skip to content

Commit

Permalink
fix: reset password bug
Browse files Browse the repository at this point in the history
  • Loading branch information
henilp105 committed Jun 16, 2023
1 parent cae240a commit 1263396
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions flask/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ def reset_password():
if not uuid:
return jsonify({"message": "Unauthorized", "code": 401}), 401

if not oldpassword:
return jsonify({"message": "Please enter old password", "code": 400}), 400

if not password:
return jsonify({"message": "Please enter new password", "code": 400}), 400

Expand Down Expand Up @@ -323,8 +320,9 @@ def verify_email():
db.users.update_one(
{"uuid": uuid}, {"$set": {"email": user["newemail"], "newemail": ""}}
)

db.users.update_one({"uuid": uuid}, {"$set": {"isverified": True}})

if not user['isverified']:
db.users.update_one({"uuid": uuid}, {"$set": {"isverified": True}})

return jsonify({"message": "Successfully Verified Email", "code": 200}), 200

Expand Down Expand Up @@ -352,7 +350,7 @@ def change_email():

db.users.update_one(
{"uuid": uuid},
{"$set": {"newemail": new_email, "isverified": False}},
{"$set": {"newemail": new_email}},
)
send_verify_email(new_email)

Expand Down

0 comments on commit 1263396

Please sign in to comment.