1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Test fix for telegram login

This commit is contained in:
Steffo 2019-06-09 18:32:14 +02:00
parent 567d0e0979
commit 63047eb124
3 changed files with 24 additions and 3 deletions

View file

@ -1,5 +1,5 @@
from . import audio, bots, commands, database, network, utils, error, web 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"] __all__ = ["audio", "bots", "commands", "database", "network", "utils", "error", "web"]

View file

@ -1,6 +1,7 @@
import flask as f import flask as f
import hashlib import hashlib
import hmac import hmac
import datetime
from ... import Royalprint from ... import Royalprint
from ....database.tables import Royal, Telegram from ....database.tables import Royal, Telegram
@ -31,5 +32,7 @@ def tglogin_done():
if tg_user is None: if tg_user is None:
return "No such telegram", 404 return "No such telegram", 404
royal_user = tg_user.royal royal_user = tg_user.royal
f.session["royal_id"] = royal_user.id f.session["login_id"] = royal_user.id
return f.redirect(f.url_for("/")) f.session["login_name"] = royal_user.name
f.session["login_date"] = datetime.datetime.now()
return f.render_template("tglogin_success.html")

View file

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}
Login with Telegram
{% endblock %}
{% block content %}
<div class="doublebox">
<div class="top">
<span class="left">
Telegram login
</span>
</div>
<div class="bot">
Login riuscito! Sei connesso come <b>{{ session["login_name"] }}</b>!
</div>
</div>
{% endblock %}