{# Extends the base layout template #} {% extends "base.html" %} {# --- Page Title Block --- #} {% block title %}{{ super() }} - Login{% endblock %} {# --- Head Scripts Block --- #} {# No specific JS usually needed for a simple login form, but block exists if needed #} {% block head_scripts %} {% endblock %} {# --- Main Content Block --- #} {% block content %} {# Wrapper for login form styling and centering (defined in forms.css) #}
{# Page Heading (Optional, header in base.html might suffice) #}

Login

{# Flash messages area (Included from base.html - displays above this block) #} {# Server-side flash messages (e.g., 'Invalid credentials') appear here #} {# Login Form #} {# Assumes 'form' object (instance of LoginForm) is passed from the Flask route #} {# Uses POST method, targets the login route URL #}
{# novalidate disables browser validation #} {# --- CSRF Token --- #} {# Render the hidden CSRF token field provided by Flask-WTF #} {{ form.csrf_token }} {# Manual alternative if not using Flask-WTF CSRF extension directly: #} {# #} {# --- Username Field --- #}
{# Render label associated with the username input #} {{ form.username.label(class="form-label") }} {# Render the username input field #} {# Add 'is-invalid' class dynamically if validation errors exist for this field #} {{ form.username(class="form-input" + (" is-invalid" if form.username.errors else ""), placeholder="Enter your username", required=True, autofocus=True) }} {# Display validation errors for the username field #} {% if form.username.errors %}
    {# Defined in forms.css #} {% for error in form.username.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}
{# --- Password Field --- #}
{# Render label associated with the password input #} {{ form.password.label(class="form-label") }} {# Render the password input field #} {# Add 'is-invalid' class dynamically if errors exist #} {{ form.password(class="form-input" + (" is-invalid" if form.password.errors else ""), placeholder="Enter your password", required=True) }} {# Display validation errors for the password field #} {% if form.password.errors %}
    {% for error in form.password.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}
{# --- Submit Button --- #} {# Use form-actions and login-actions classes for layout/styling #}
{# --- End Login Form --- #}
{# --- End .login-wrapper --- #} {% endblock %} {# --- Optional Body Scripts Block --- #} {% block body_scripts %} {# #} {% endblock %}