#!/usr/bin/env python3 """ Debug login issue. """ import re import httpx BASE_URL = "http://localhost:8000" def main(): print("Debugging login issue...") with httpx.Client(base_url=BASE_URL, timeout=30.0) as client: # Get login page response = client.get("/admin/login") print(f"Login page status: {response.status_code}") # Extract CSRF token match = re.search(r'name="csrf_token" value="([^"]+)"', response.text) csrf_token = match.group(1) if match else "" print(f"CSRF token: {csrf_token[:30]}...") # Look for any error messages in the page if "error" in response.text.lower(): print("\n=== Error messages in login page ===") # Extract error div content error_match = re.search( r'