add logout route

This commit is contained in:
2026-04-29 19:22:30 +03:00
parent 3870356ffa
commit e670c176e8
2 changed files with 16 additions and 6 deletions

View File

@@ -57,6 +57,15 @@ def create_session(user_id, temporary=False):
'expires_at': int(time.time()) + (expires_days * 24 * 60 * 60),
})
def revoke_session(user_id):
if not is_logged_in():
return
sess = Sessions.find({'key': session['pyrom_session_key']})
if not sess:
return
sess.delete()
session.clear()
def parse_username(username: str) -> Tuple[str, str]:
"""first is the unmodified name/display name, second is username"""
if len(username) < 3: