Fixed wrong base url used by the auth API

This commit is contained in:
2025-11-10 16:08:29 +01:00
parent 3d46e092aa
commit a547b2b882
2 changed files with 18 additions and 16 deletions

View File

@@ -18,7 +18,7 @@ from ..auth.utils import (
)
def setup_auth_routes(app, rt, mount_auth_app=True, sqlite_db_path="Users.db"):
def setup_auth_routes(app, rt, mount_auth_app=True, sqlite_db_path="Users.db", base_url=None):
"""
Setup all authentication and protected routes.
@@ -27,6 +27,7 @@ def setup_auth_routes(app, rt, mount_auth_app=True, sqlite_db_path="Users.db"):
rt: Route decorator from FastHTML
mount_auth_app: Whether to mount the auth FastApi API routes
sqlite_db_path: by default, create a new SQLite database at this path
base_url: Base URL for the application (default to localhost:5001 if not provided)
"""
# ============================================================================
@@ -61,7 +62,7 @@ def setup_auth_routes(app, rt, mount_auth_app=True, sqlite_db_path="Users.db"):
RedirectResponse on success, or LoginPage with error on failure
"""
# Attempt login
auth_data = login_user(email, password)
auth_data = login_user(email, password, base_url=base_url)
if auth_data:
# Login successful - store tokens in session