{# app/templates/admin/test-auth-flow.html #} {% extends 'admin/base.html' %} {% from 'shared/macros/headers.html' import page_header %} {% block title %}Auth Flow Testing{% endblock %} {% block content %}
{{ page_header('Auth Flow Testing', subtitle='Comprehensive testing for Jinja2 migration auth loop fix') }} {# Log Level Control #}

Log Level Control

Change logging verbosity for login.js and api-client.js

Current: LOGIN = 4, API = 3

{# Test Sections Grid #}
{# Test 1: Clean Slate #}

Test 1: Clean Slate - Fresh Login

Tests complete login flow from scratch with no existing tokens.

  1. Clear All Data
  2. Navigate to /admin
  3. Should land on login page

Expected: Single redirect /admin -> /admin/login, no loops

{# Test 2: Successful Login #}

Test 2: Successful Login

Tests that login works correctly and redirects to dashboard.

  1. Go to /admin/login
  2. Enter valid admin credentials
  3. Click Login

Expected: Token stored, redirect to /admin/dashboard

{# Test 3: Dashboard Refresh #}

Test 3: Dashboard Refresh

Tests that refreshing dashboard works without redirect loops.

  1. Complete Test 2 (login)
  2. Press F5 or click Refresh
  3. Dashboard should reload normally

Expected: No redirect to login, stats load correctly

{# Test 4: Expired Token #}

Test 4: Expired Token Handling

Tests that expired tokens are handled gracefully.

  1. Set Expired Token
  2. Navigate to Dashboard
  3. Should redirect to login

Expected: 401 response, redirect to login, no loops

{# Test 5: Direct Access (No Token) #}

Test 5: Direct Access (Unauthenticated)

Tests accessing dashboard without token redirects to login.

  1. Clear All Data
  2. Navigate to Dashboard
  3. Should redirect to login

Expected: Redirect to /admin/login, no API calls

{# Test 6: Login with Valid Token #}

Test 6: Login Page with Valid Token

Tests visiting login page while already authenticated.

  1. Login successfully (Test 2)
  2. Click Go to Login Page
  3. Token should be cleared

Expected: Token cleared, form displayed, no loops

{# Status Panel #}

Current Auth Status

Current URL: -
Has admin_token: -
Has admin_user: -
Token Preview: -
Username: -
{# Warning Box #}

Important Notes

{% endblock %} {% block extra_scripts %} {% endblock %}