diff --git a/royalnet/__init__.py b/royalnet/__init__.py index 9a404b18..c8ee0950 100644 --- a/royalnet/__init__.py +++ b/royalnet/__init__.py @@ -1,5 +1,5 @@ from . import audio, bots, commands, database, network, utils, error, web -version = "5.0a16" +version = "5.0a17" __all__ = ["audio", "bots", "commands", "database", "network", "utils", "error", "web"] diff --git a/royalnet/web/blueprints/tglogin/__init__.py b/royalnet/web/blueprints/tglogin/__init__.py index c7aa280d..bdc393da 100644 --- a/royalnet/web/blueprints/tglogin/__init__.py +++ b/royalnet/web/blueprints/tglogin/__init__.py @@ -1,6 +1,7 @@ import flask as f import hashlib import hmac +import datetime from ... import Royalprint from ....database.tables import Royal, Telegram @@ -31,5 +32,7 @@ def tglogin_done(): if tg_user is None: return "No such telegram", 404 royal_user = tg_user.royal - f.session["royal_id"] = royal_user.id - return f.redirect(f.url_for("/")) + f.session["login_id"] = royal_user.id + f.session["login_name"] = royal_user.name + f.session["login_date"] = datetime.datetime.now() + return f.render_template("tglogin_success.html") diff --git a/royalnet/web/blueprints/tglogin/templates/tglogin_success.html b/royalnet/web/blueprints/tglogin/templates/tglogin_success.html new file mode 100644 index 00000000..3dbabb48 --- /dev/null +++ b/royalnet/web/blueprints/tglogin/templates/tglogin_success.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block title %} + Login with Telegram +{% endblock %} + +{% block content %} +
+
+ + Telegram login + +
+
+ Login riuscito! Sei connesso come {{ session["login_name"] }}! +
+
+{% endblock %}