I am using Flask-Security with my Flask-Admin app.
The login.html template current is:
% extends "base.html" %}
{% from "security/_macros.html"
import render_field_with_errors, render_field %}
{% block content %}
{% include "security/_messages.html" %}
Custom Login Form
{{ login_form.hidden_tag() }}
{{ render_field_with_errors(login_form.email) }}
{{ render_field_with_errors(login_form.password) }}
{{ render_field_with_errors(login_form.remember) }}
{{ render_field(login_form.next) }}
{{ render_field(login_form.submit) }}
{% include "security/_menu.html" %}
{% endblock %}
This is in /templates/security/login_user.html. I set this to be the file loaded in my config.
SECURITY_LOGIN_USER_TEMPLATE = 'security/login_user.html'
If I change Custom login form to something else, the text changes so it is loading this file correctly. The only issue is there is no styling on it. Its like the CSS isn't getting picked up:
flask-admin_1 | raise value.with_traceback(tb)
flask-admin_1 | File "/code/app/templates/security/login_user.html", line 3, in top-level template code
flask-admin_1 | {% from "security/_macros.html" import render_field_with_errors, render_field %}
flask-admin_1 | File "/code/app/templates/base.html", line 26, in top-level template code
flask-admin_1 | {% block content %}
flask-admin_1 | File "/code/app/templates/security/login_user.html", line 9, in block "content"
flask-admin_1 | {{ login_form.hidden_tag() }}
flask-admin_1 | File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 408, in getattr
flask-admin_1 | return getattr(obj, attribute)
flask-admin_1 | jinja2.exceptions.UndefinedError: 'login_form' is undefined
base.html*
<html>
<head>
<title>Flask-Security Example</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
{%- with messages = get_flashed_messages(with_categories=true) -%}
{% if messages %}
<ul class=flashes>
{% for category, message in messages %}
<li class="{{ category }}">{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{%- endwith %}
<ul>
{% if current_user.is_authenticated %}
<li>Hello {{ current_user.email }}</li>
<li><a href="{{ url_for('security.logout') }}">Logout</a></li>
{% else %}
<li><a href="{{ url_for('security.login') }}">Login</a></li>
<li><a href="{{ url_for('security.register') }}">Register</a></li>
{% endif %}
</ul>
{% block content %}
{% endblock %}
</body>
</html>