piwigo: Sent a fake cookie.

shotwell needs a pwg_id cookie to continue.
And really, it's the only cookie it supports, so in the
long run, we need to send a proper session cookie as
pwg_id.
This commit is contained in:
Elrond 2013-03-21 09:01:48 +01:00
parent 1330abf722
commit dc7c26f355

View File

@ -69,6 +69,19 @@ def pwg_categories_getList(request):
}
def possibly_add_cookie(request, response):
# TODO: We should only add a *real* cookie, if
# authenticated. And if there is no cookie already.
if True:
response.set_cookie(
'pwg_id',
"some_fake_for_now",
path=request.environ['SCRIPT_NAME'],
domain=mg_globals.app_config.get('csrf_cookie_domain'),
secure=(request.scheme.lower() == 'https'),
httponly=True)
@csrf_exempt
def ws_php(request):
if request.method not in ("GET", "POST"):
@ -86,4 +99,8 @@ def ws_php(request):
if isinstance(result, BaseResponse):
return result
return response_xml(result)
response = response_xml(result)
possibly_add_cookie(request, response)
return response