set cookie expiration adte

This commit is contained in:
maaa 2023-07-08 21:19:07 +02:00
parent 4b081db610
commit 0b6578d985
1 changed files with 5 additions and 1 deletions

6
main
View File

@ -5,6 +5,7 @@ import sqlite3
import time import time
import json import json
import secrets import secrets
import datetime
from itertools import groupby from itertools import groupby
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.security import generate_password_hash, check_password_hash
@ -274,8 +275,11 @@ def login():
conn.commit() conn.commit()
conn.close() conn.close()
expire_date = datetime.datetime.now
expire_date = expire_date + datetime.timedelta(days=365)
resp = make_response(redirect("/")) resp = make_response(redirect("/"))
resp.set_cookie("session_DO_NOT_SHARE", randomCharacters) resp.set_cookie("session_DO_NOT_SHARE", randomCharacters, expires=expire_date)
return resp return resp
else: else: