From e5c266c481796ea177e048b8ca30e251bcfe0f1b Mon Sep 17 00:00:00 2001 From: Mo8it Date: Tue, 20 Sep 2022 18:11:25 +0200 Subject: [PATCH] Custom login template --- advlabdb/config.py | 1 - advlabdb/templates/security/login_user.html | 103 ++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 advlabdb/templates/security/login_user.html diff --git a/advlabdb/config.py b/advlabdb/config.py index 1106ead..71cfd79 100644 --- a/advlabdb/config.py +++ b/advlabdb/config.py @@ -82,4 +82,3 @@ def set_config(app, data_dir: Path): 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_POST_LOGIN_VIEW"] = "/post-login" - # TODO: app.config["SECURITY_LOGIN_USER_TEMPLATE"] = diff --git a/advlabdb/templates/security/login_user.html b/advlabdb/templates/security/login_user.html new file mode 100644 index 0000000..3ff4736 --- /dev/null +++ b/advlabdb/templates/security/login_user.html @@ -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 %} + + + +
+
+

AdvLabDB

+

Database for labs

+ +

Login

+ + {% include "security/_messages.html" %} + +
+ +
+ {{ login_user_form.hidden_tag() }} + {{ render_form_errors(login_user_form) }} + +
+ + + + + + + + + +
+ Email + + {{ login_user_form.email() }} +
+ Password + + {{ login_user_form.password() }} +
+
+ + {% if login_user_form.email.errors %} +
    + {% for error in login_user_form.email.errors %} +
  • {{ error }}
  • + {% endfor %} +
+ {% endif %} + + {% if login_user_form.password.errors %} +
    + {% for error in login_user_form.password.errors %} +
  • {{ error }}
  • + {% endfor %} +
+ {% endif %} + +
+ + Remember me {{ login_user_form.remember() }} + + {% if login_user_form.remember.errors %} +
    + {% for error in login_user_form.remember.errors %} +
  • {{ error }}
  • + {% endfor %} +
+ {% endif %} + + {{ render_field_errors(login_user_form.csrf_token) }} + +
+ + {{ render_field(login_user_form.submit) }} +
+
+
+
+{% endblock body %}