mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2025-06-29 04:25:11 +00:00
Create initial version of SourceCodeEventHandler
This commit is contained in:
26
src/event_handlers/source_code_server/server.py
Normal file
26
src/event_handlers/source_code_server/server.py
Normal file
@ -0,0 +1,26 @@
|
||||
import json
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.web import RequestHandler, Application
|
||||
|
||||
from config import LOGIN_APP_PORT
|
||||
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(LOGIN_APP_PORT)
|
||||
IOLoop.instance().start()
|
BIN
src/event_handlers/source_code_server/users.db
Normal file
BIN
src/event_handlers/source_code_server/users.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user