From 0cd294d61f80e797106271f28ad9a5b77aaffdf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Bokros?= Date: Tue, 13 Feb 2018 13:35:34 +0100 Subject: [PATCH] Create token in controller --- src/controller/app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controller/app.py b/src/controller/app.py index 67b2faa..2a0b507 100644 --- a/src/controller/app.py +++ b/src/controller/app.py @@ -1,3 +1,4 @@ +import secrets from tornado.ioloop import IOLoop from tornado.web import Application @@ -10,10 +11,13 @@ from tfw.config.logs import logging log = logging.getLogger(__name__) if __name__ == '__main__': - solvable_connector = AsyncSolvableConnector() + kwargs = { + 'solvable_connector': AsyncSolvableConnector(), + 'token': secrets.token_hex(32) + } routes = [ - (r'/{secret}/?'.format(secret=taoenv.SECRET), SolutionCheckHandler, {'solvable_connector': solvable_connector}), - (r'/{secret}/test/?'.format(secret=taoenv.SECRET), TestHandler, {'solvable_connector': solvable_connector}) + (r'/{secret}/?'.format(secret=taoenv.SECRET), SolutionCheckHandler, kwargs), + (r'/{secret}/test/?'.format(secret=taoenv.SECRET), TestHandler, kwargs) ] app = Application( routes