forked from forks/microblog.pub
Tweak the login page
This commit is contained in:
parent
e3284416d2
commit
5323995633
3 changed files with 17 additions and 4 deletions
3
app.py
3
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":
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
{% block links %}{% endblock %}
|
||||
{% if config.THEME_COLOR %}<meta name="theme-color" content="{{ config.THEME_COLOR }}">{% endif %}
|
||||
<style>{{ config.CSS | safe }}</style>
|
||||
{% block headers %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% if logged_in %}
|
||||
|
@ -20,7 +21,7 @@
|
|||
<li class="left"><a href="/admin/new"{% if request.path == "/admin/new" %} class="selected" {% endif %}>New</a></li>
|
||||
<li class="left"><a href="/admin/stream"{% if request.path == "/admin/stream" %} class="selected" {% endif %}>Stream</a></li>
|
||||
<li class="left"><a href="/admin/notifications"{% if request.path == "/admin/notifications" %} class="selected" {% endif %}>Notifications</a></li>
|
||||
<li class="right"><a href="/admin/logout">Logout</a></li>
|
||||
<li class="left"><a href="/admin/logout">Logout</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
{% extends "layout.html" %}
|
||||
{% import 'utils.html' as utils %}
|
||||
{% block title %}Login - {{ config.NAME }}{% endblock %}
|
||||
{% block header %}
|
||||
{% block headers %}
|
||||
<style>
|
||||
#login-container {
|
||||
height: 90%;
|
||||
display: grid;
|
||||
}
|
||||
#login-form {
|
||||
margin:auto;
|
||||
display:inline;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div id="container">
|
||||
{% if session.logged_in %}logged{% else%}not logged{%endif%}
|
||||
<div id="login-container">
|
||||
|
||||
<form id="login-form" method="POST">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
|
|
Loading…
Reference in a new issue