1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Telegram login improvements

This commit is contained in:
Steffo 2019-08-03 12:28:27 +02:00
parent 92343183c5
commit 02d1419204
6 changed files with 46 additions and 19 deletions

View file

@ -16,8 +16,8 @@ rp = Royalprint("tglogin", __name__, url_prefix="/login/telegram", required_tabl
@rp.route("/") @rp.route("/")
def tglogin_index(): def tglogin_index():
if f.request.url_root != "https://ryg.steffo.eu/": #if f.request.url_root != "https://ryg.steffo.eu/":
return error(404, "Il login tramite Telegram non è possibile su questo dominio.") # return error(404, "Il login tramite Telegram non è possibile su questo dominio.")
f.session.pop("royal", None) f.session.pop("royal", None)
return f.render_template("tglogin_index.html") return f.render_template("tglogin_index.html")

View file

@ -12,26 +12,28 @@
</span> </span>
</div> </div>
<div class="dbox-bot"> <div class="dbox-bot">
<div class="center tg-login-container">
<script async src="https://telegram.org/js/telegram-widget.js?6" data-telegram-login="royalgamesbot" data-size="large" data-auth-url="{{ url_for("tglogin.tglogin_done") }}" data-request-access="write"></script>
</div>
<p> <p>
Facendo il login su questo sito, acconsenti a ricevere due <abbr title="cookie">biscottini</abbr> che memorizzino l'account con cui hai fatto il login.<br> Per fare il login, devi aver <code>sync</code>ato il tuo account sul gruppo Telegram Royal Games!
</p> </p>
<p> <div class="tiny">
Essi avranno il seguente formato: <p>
</p> Facendo il login su questo sito, acconsenti a ricevere due <abbr title="cookie">biscottini</abbr> che memorizzino l'account con cui hai fatto il login.<br>
<pre><code>session["royal"] = { </p>
"uid": [il tuo id Royalnet] <p>
"username": [il tuo username Royalnet], Essi avranno il seguente formato:
"avatar": [il tuo avatar Royalnet], </p>
"role": [il tuo ruolo Royalnet] <pre><code>session["royal"] = {
"uid": [il tuo id Royalnet]
"username": [il tuo username Royalnet],
"avatar": [il tuo avatar Royalnet],
"role": [il tuo ruolo Royalnet]
} }
session["login_date"] = [la data e l'ora di adesso]</code></pre> session["login_date"] = [la data e l'ora di adesso]</code></pre>
<p> </div>
<script async src="https://telegram.org/js/telegram-widget.js?6" data-telegram-login="royalgamesbot" data-size="large" data-auth-url="{{ url_for("tglogin.tglogin_done") }}" data-request-access="write"></script>
</p>
<p>
Nota: per fare il login, devi aver <code>sync</code>ato il tuo account sul gruppo Telegram Royal Games!
</p>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -336,6 +336,13 @@ form.full label.label-big * {
.disabled { .disabled {
opacity: 0.3; opacity: 0.3;
} }
/*** Modifiers ***/
.tiny {
font-size: xx-small;
}
.center {
margin: auto;
}
/*** Custom elements ***/ /*** Custom elements ***/
.CodeMirror { .CodeMirror {
font-family: "Consolas", monospace !important; font-family: "Consolas", monospace !important;
@ -751,4 +758,8 @@ form.full label.label-big * {
.profile .profile-stats .stats-value { .profile .profile-stats .stats-value {
font-weight: bold; font-weight: bold;
} }
.tg-login-container {
width: 238px;
height: 40px;
}
/*# sourceMappingURL=ryg.css.map */ /*# sourceMappingURL=ryg.css.map */

File diff suppressed because one or more lines are too long

View file

@ -418,6 +418,15 @@ form.full {
} }
/*** Modifiers ***/
.tiny {
font-size: xx-small;
}
.center {
margin: auto;
}
/*** Custom elements ***/ /*** Custom elements ***/
@ -946,3 +955,8 @@ form.full {
} }
} }
} }
.tg-login-container {
width: 238px;
height: 40px;
}

View file

@ -46,7 +46,7 @@
</a> </a>
{% else %} {% else %}
<span class="nav-login"> <span class="nav-login">
<a class="no-icon" href="{{ url_for("login.login_index") }}"> <a class="no-icon" href="{{ url_for("tglogin.tglogin_index") }}">
Login Login
<img class="nav-image disabled" alt="" src="{{ url_for("static", filename="generic.png") }}"> <img class="nav-image disabled" alt="" src="{{ url_for("static", filename="generic.png") }}">
</a> </a>