From 5323995633b318d2f8e5b493ab7f83adff976fb0 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 15 Jul 2018 21:25:09 +0200 Subject: [PATCH] Tweak the login page --- app.py | 3 +++ templates/layout.html | 3 ++- templates/login.html | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 91003bc..d289858 100644 --- a/app.py +++ b/app.py @@ -471,6 +471,9 @@ def admin_logout(): @app.route("/login", methods=["POST", "GET"]) def admin_login(): + if session.get("logged_in") is True: + return redirect(url_for("admin_notifications")) + devices = [doc["device"] for doc in DB.u2f.find()] u2f_enabled = True if devices else False if request.method == "POST": diff --git a/templates/layout.html b/templates/layout.html index 21522fa..5956de5 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -12,6 +12,7 @@ {% block links %}{% endblock %} {% if config.THEME_COLOR %}{% endif %} +{% block headers %}{% endblock %} {% if logged_in %} @@ -20,7 +21,7 @@
  • New
  • Stream
  • Notifications
  • -
  • Logout
  • +
  • Logout
  • {% endif %} diff --git a/templates/login.html b/templates/login.html index 603808c..fde73d2 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,11 +1,20 @@ {% extends "layout.html" %} {% import 'utils.html' as utils %} {% block title %}Login - {{ config.NAME }}{% endblock %} -{% block header %} +{% block headers %} + {% endblock %} {% block content %} -
    - {% if session.logged_in %}logged{% else%}not logged{%endif%} +