1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2025-04-03 10:32:40 +00:00
2018-03-23 15:27:42 +01:00

28 lines
708 B
Python

import json, sys
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application
from tfw.config import tfwenv
sys.path.append(tfwenv.WEBIDE_WD)
from login_component import authorize_login
class LoginHandler(RequestHandler):
def post(self, *args, **kwargs):
request = json.loads(self.request.body)
email, is_admin = authorize_login(
request['email'],
request['password']
)
self.write({
'email': email,
'is_admin': is_admin
})
if __name__ == '__main__':
application = Application([(r'/login', LoginHandler)])
application.listen(tfwenv.LOGIN_APP_PORT)
IOLoop.instance().start()