Skip to content

Commit

Permalink
longer sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Jan 21, 2024
1 parent 0c41974 commit 2ad1926
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
import datetime

from . import schema as s

Expand Down Expand Up @@ -32,6 +33,7 @@ def create_app(test_config=None):
DATABASE_ECHO=False,
SESSION_COOKIE_SECURE=True,
SESSION_COOKIE_SAMESITE="None",
PERMANENT_SESSION_LIFETIME=datetime.timedelta(days=365)
)
if test_config is None: # pragma: no cover
# load the instance config, if it exists, when not testing
Expand Down
1 change: 1 addition & 0 deletions backend/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ def login(self, info: Info, username: str, password: str) -> t.Optional[m.User]:
user = by_username(info, username)
if not user or not user.check_password(password):
raise Exception("User not found")
info.context["cookie"].permanent = True
info.context["cookie"]["username"] = user.username
return user

Expand Down

0 comments on commit 2ad1926

Please sign in to comment.