Fix - Connection without session
This commit is contained in:
parent
4ff9a03664
commit
0ce48a5977
|
@ -111,6 +111,11 @@ class AppValues(object):
|
||||||
def on_delete(self, req, resp, table):
|
def on_delete(self, req, resp, table):
|
||||||
values = req.params
|
values = req.params
|
||||||
session = req.env['beaker.session']
|
session = req.env['beaker.session']
|
||||||
|
if not 'userobj' in session:
|
||||||
|
session.delete()
|
||||||
|
resp.status = falcon.HTTP_200
|
||||||
|
raise falcon.HTTPTemporaryRedirect('/')
|
||||||
|
|
||||||
if table == 'usuario' and (session['userobj'].id == int(values['id'])):
|
if table == 'usuario' and (session['userobj'].id == int(values['id'])):
|
||||||
resp.status = falcon.HTTP_204
|
resp.status = falcon.HTTP_204
|
||||||
return
|
return
|
||||||
|
@ -250,6 +255,11 @@ class AppInvoices(object):
|
||||||
def on_post(self, req, resp):
|
def on_post(self, req, resp):
|
||||||
values = req.params
|
values = req.params
|
||||||
session = req.env['beaker.session']
|
session = req.env['beaker.session']
|
||||||
|
if not 'userobj' in session:
|
||||||
|
session.delete()
|
||||||
|
resp.status = falcon.HTTP_200
|
||||||
|
raise falcon.HTTPTemporaryRedirect('/')
|
||||||
|
|
||||||
req.context['result'] = self._db.invoice(values, session['userobj'])
|
req.context['result'] = self._db.invoice(values, session['userobj'])
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
|
|
||||||
|
@ -297,6 +307,11 @@ class AppTickets(object):
|
||||||
def on_post(self, req, resp):
|
def on_post(self, req, resp):
|
||||||
values = req.params
|
values = req.params
|
||||||
session = req.env['beaker.session']
|
session = req.env['beaker.session']
|
||||||
|
if not 'userobj' in session:
|
||||||
|
session.delete()
|
||||||
|
resp.status = falcon.HTTP_200
|
||||||
|
raise falcon.HTTPTemporaryRedirect('/')
|
||||||
|
|
||||||
req.context['result'] = self._db.tickets(values, session['userobj'])
|
req.context['result'] = self._db.tickets(values, session['userobj'])
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,11 @@ class ConnectionMiddleware(object):
|
||||||
def process_resource(self, req, resp, resource, params):
|
def process_resource(self, req, resp, resource, params):
|
||||||
id_session = req.cookies.get('beaker.session.id', '')
|
id_session = req.cookies.get('beaker.session.id', '')
|
||||||
session = req.env['beaker.session']
|
session = req.env['beaker.session']
|
||||||
print ('\n\n', id_session, session, '\n\n')
|
if not 'userobj' in session:
|
||||||
|
session.delete()
|
||||||
|
resp.status = falcon.HTTP_200
|
||||||
|
raise falcon.HTTPTemporaryRedirect('/')
|
||||||
|
|
||||||
rfc = session.get('rfc', '')
|
rfc = session.get('rfc', '')
|
||||||
if id_session and rfc:
|
if id_session and rfc:
|
||||||
opt = util.get_con(rfc)
|
opt = util.get_con(rfc)
|
||||||
|
|
Loading…
Reference in New Issue