2
0
mirror of https://github.com/codl/forget synced 2025-01-07 12:52:34 +01:00
forget-cancellare-vecchi-toot/lib/session.py
2017-08-10 17:07:39 +02:00

19 lines
463 B
Python

from flask import request
def set_session_cookie(session, response, secure=True):
response.set_cookie('forget_sid', session.id,
max_age=60*60*48,
httponly=True,
secure=secure)
def get_viewer_session():
from model import Session
sid = request.cookies.get('forget_sid', None)
if sid:
return Session.query.get(sid)
def get_viewer():
session = get_viewer_session()
if session:
return session.account