1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Custom login template

This commit is contained in:
Mo 2022-09-20 18:11:25 +02:00
parent 4d8947b89e
commit e5c266c481
2 changed files with 103 additions and 1 deletions

View file

@ -82,4 +82,3 @@ def set_config(app, data_dir: Path):
app.config["SECURITY_PASSWORD_SALT"] = secrets["SECURITY_PASSWORD_SALT"] app.config["SECURITY_PASSWORD_SALT"] = secrets["SECURITY_PASSWORD_SALT"]
app.config["SECURITY_PASSWORD_LENGTH_MIN"] = settings.getint("SECURITY_PASSWORD_LENGTH_MIN", 15) app.config["SECURITY_PASSWORD_LENGTH_MIN"] = settings.getint("SECURITY_PASSWORD_LENGTH_MIN", 15)
app.config["SECURITY_POST_LOGIN_VIEW"] = "/post-login" app.config["SECURITY_POST_LOGIN_VIEW"] = "/post-login"
# TODO: app.config["SECURITY_LOGIN_USER_TEMPLATE"] =

View file

@ -0,0 +1,103 @@
{% extends "security/base.html" %}
{% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors, render_form_errors %}
{% block title %}AdvLabDB - Login{% endblock title %}
{% block body_attribs %}
style="
background-image: radial-gradient(#35393b, #181a1b);
"
{% endblock body_attribs %}
{% block body %}
<style>
.fs-error-msg {
color: #ff6b6b;
}
</style>
<font color="white">
<div style="
display: flex;
justify-content: center;
align-items: center;
height: 95vh;
">
<div style="
text-align: center;
">
<h1>AdvLabDB</h1>
<p>Database for labs</p>
<h2>Login</h2>
{% include "security/_messages.html" %}
<br>
<form action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
{{ login_user_form.hidden_tag() }}
{{ render_form_errors(login_user_form) }}
<div style="
display: flex;
justify-content: center;
">
<table>
<tr>
<td>
Email
</td>
<td>
{{ login_user_form.email() }}
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
{{ login_user_form.password() }}
</td>
</tr>
</table>
</div>
{% if login_user_form.email.errors %}
<ul>
{% for error in login_user_form.email.errors %}
<li class="fs-error-msg">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% if login_user_form.password.errors %}
<ul>
{% for error in login_user_form.password.errors %}
<li class="fs-error-msg">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
<br>
Remember me {{ login_user_form.remember() }}
{% if login_user_form.remember.errors %}
<ul>
{% for error in login_user_form.remember.errors %}
<li class="fs-error-msg">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{{ render_field_errors(login_user_form.csrf_token) }}
<br>
{{ render_field(login_user_form.submit) }}
</form>
</div>
</div>
</font>
{% endblock body %}