From dbf485fa1d5d99cbcb11db823865d2793d484343 Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Sat, 20 Jan 2018 05:05:02 +0100 Subject: [PATCH] Fix in little things --- paramecio/citoplasma/httputils.py | 6 +++--- paramecio/modules/admin/templates/admin/login.phtml | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/paramecio/citoplasma/httputils.py b/paramecio/citoplasma/httputils.py index 96eb16f..2300d4a 100644 --- a/paramecio/citoplasma/httputils.py +++ b/paramecio/citoplasma/httputils.py @@ -99,7 +99,7 @@ class GetPostFiles: s=get_session() if ignore_csrf_token==False and no_csrf==False: - + if 'csrf_token' in s: self.post['csrf_token']=self.post.get('csrf_token', '') @@ -107,7 +107,7 @@ class GetPostFiles: if self.post['csrf_token']!=s['csrf_token'] or self.post['csrf_token'].strip()=="": #raise NameError('Error: you need a valid csrf_token') - raise HTTPResponse(body=json.dumps({'error_csrf': 1, 'error': 1}), status=200, headers={'Content-type': 'application/json'}) + raise HTTPResponse(body=json.dumps({'error_csrf': 1, 'error': 1, 'token_invalid': 1}), status=200, headers={'Content-type': 'application/json'}) else: #Clean csrf_token @@ -120,7 +120,7 @@ class GetPostFiles: else: #raise NameError('Error: you don\'t send any valid csrf_token') - raise HTTPResponse(body=json.dumps({'error_csrf': 1, 'error': 1}), status=200, headers={'Content-type': 'application/json'}) + raise HTTPResponse(body=json.dumps({'error_csrf': 1, 'error': 1, 'token_invalid': 0}), status=200, headers={'Content-type': 'application/json'}) #Check post_token diff --git a/paramecio/modules/admin/templates/admin/login.phtml b/paramecio/modules/admin/templates/admin/login.phtml index b1e6cd6..10950f1 100644 --- a/paramecio/modules/admin/templates/admin/login.phtml +++ b/paramecio/modules/admin/templates/admin/login.phtml @@ -35,7 +35,8 @@ if(data.error==0) { - window.location.href="${make_url('admin')}"; + //window.location.href="${make_url('admin')}"; + location.reload() } else