@@ -0,0 +1,21 @@
|
||||
"""Cookie терминала киоска (wesp_kiosk_device_id)."""
|
||||
|
||||
from flask import current_app
|
||||
|
||||
COOKIE_NAME = "wesp_kiosk_device_id"
|
||||
|
||||
|
||||
def kiosk_cookie_max_age() -> int:
|
||||
return int(current_app.config.get("KIOSK_AUTH_COOKIE_DAYS", 30)) * 24 * 3600
|
||||
|
||||
|
||||
def set_kiosk_device_cookie(response, device_id: str):
|
||||
"""Привязать браузер к конкретному KioskDevice."""
|
||||
response.set_cookie(
|
||||
COOKIE_NAME,
|
||||
device_id,
|
||||
max_age=kiosk_cookie_max_age(),
|
||||
httponly=True,
|
||||
samesite="Lax",
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user