Esempio n. 1
0
File: main.py Progetto: vegarwe/sqrl
def main():
    args = parse_args()

    log_setup.log_setup(verbose=args.verbose)

    manager = MKM(args.path)

    if args.select:
        select_account(manager, args.select[0])
    elif args.list:
        list_accounts(manager)
    elif args.create:
        create_account(manager)
    elif args.disable:
        disable(manager, args.sqrl_url)
    else:
        run(manager, args.sqrl_url, args.cps)
Esempio n. 2
0
        self.redirect('/user?session_id=%s&msg=User+updated' % session_id)

    def get_argument(self, key, default):
        argument = tornado.web.RequestHandler.get_argument(self, key, default)
        if re.match(r'^[A-Za-z0-9_ +-]*$', argument):
            return argument
        logging.error("Input did not match! %r", argument)
        return default

    def writeln(self, text):
        self.write(text)
        self.write('\n')


if __name__ == "__main__":
    log_setup.log_setup(verbose=True)

    sqrl_callback = SqrlCallback()

    application = tornado.web.Application([
        (r'/ws', SocketHandler),
        (r"/sqrl", SqrlHandler),
        (r"/(.*)", HtmlHandler),
    ])
    ssl_options = None
    if SCHEME == 'https':
        ssl_options = {
                "certfile": os.path.join(__dir__, "ssl", "signed.crt"),
                "keyfile": os.path.join(__dir__,  "ssl", "domain.key"),
                }
    http_server = tornado.httpserver.HTTPServer(application, ssl_options=ssl_options)