Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Temporarily remove token rotating #299

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions security.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ def create_user_token(username: str, ip: str, used_token: Optional[str] = None)
"content": "Your account was scheduled for deletion but you logged back in. Your account is no longer scheduled for deletion! If you didn't request for your account to be deleted, please change your password immediately."
}))

# Return original token if one is specified
# This is a temporary fix for people being randomly logged out
if used_token:
return used_token

# Generate new token, revoke used token, and update last seen timestamp
new_token = secrets.token_urlsafe(TOKEN_BYTES)
account["tokens"].append(new_token)
Expand Down