From 1b9f07db6cba127a107ba260f4fe9b898b0c9241 Mon Sep 17 00:00:00 2001 From: iou1name Date: Sat, 15 Aug 2020 01:28:58 -0400 Subject: [PATCH] update buckler middleware --- buckler_aiohttp.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/buckler_aiohttp.py b/buckler_aiohttp.py index bb10047..db321aa 100644 --- a/buckler_aiohttp.py +++ b/buckler_aiohttp.py @@ -30,7 +30,14 @@ async def buckler_session(request, handler): async with session.get(url, params=params) as resp: data = await resp.json() if data.get('error'): - raise web.HTTPFound(location=config.buckler['login_url']) + resp = web.HTTPFound(config.buckler['login_url']) + resp.set_cookie( + 'redirect', + request.url, + secure=True, + httponly=True) + #samesite='strict') + raise resp request['session'] = data['session_data'] request['meta'] = data['meta'] @@ -51,11 +58,13 @@ async def buckler_session(request, handler): max_age=30*24*60*60, secure=True, httponly=True) + #samesite='strict') resp.set_cookie( 'session', user_sid, max_age=30*24*60*60, secure=True, httponly=True) + #samesite='strict') return resp