Commit 137e65d4 authored by Jogi Hofmüller's avatar Jogi Hofmüller

Set anonymous cookie

parent e7ecc50a
......@@ -84,24 +84,28 @@ class FileHandler(tornado.web.RequestHandler):
class RestHandler(tornado.web.RequestHandler):
def set_default_headers(self):
# while testing leave this open to anyone
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, DELETE, PUT')
self.set_header("Access-Control-Allow-Headers", 'content-type')
@tornado.web.asynchronous
def post(self, *args):
pass
@tornado.web.asynchronous
def put(self, *args):
pass
class GeruechtHandler(RestHandler):
def set_default_headers(self):
# while testing leave this open to anyone
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Methods', 'GET')
self.set_header('Access-Control-Allow-Credentials', 'true')
@tornado.web.asynchronous
def get(self):
# cookie first ...
if not self.get_cookie('user'):
self.set_cookie('user', 'anonymous')
logmsg('set anonymous cookie')
else:
logmsg('cookie found')
geruecht = gdb.getNextGeruecht()
if not geruecht:
data = {'status': 'error'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment