start the new topics route and view

This commit is contained in:
2026-04-12 23:36:50 +03:00
parent 099b5c135e
commit ce9bca0a75
11 changed files with 141 additions and 34 deletions

View File

@@ -1,4 +1,7 @@
from flask import session, flash
from .models import Sessions
from argon2 import PasswordHasher
import time
ph = PasswordHasher()
@@ -10,3 +13,16 @@ def verify(expected, given):
return ph.verify(expected, given)
except:
return False
def is_logged_in():
if "pyrom_session_key" not in session:
return False
sess = Sessions.find({"key": session["pyrom_session_key"]})
if not sess:
return False
if sess.expires_at < int(time.time()):
session.clear()
sess.delete()
# flash('Your session expired.;Please log in again.', InfoboxKind.INFO)
return False
return True