feat(auth): add session-based login/logout with bcrypt hashing, seed default admin, templates and navbar updates; add auth middleware; pin SQLAlchemy 1.4.x for Py3.13; update TODOs

This commit is contained in:
HotSwapp
2025-10-06 19:04:36 -05:00
parent 227c74294f
commit 6aa4d59a25
14 changed files with 466 additions and 17 deletions

View File

@@ -33,8 +33,8 @@ engine = create_engine(
# Create session factory
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
# Create declarative base for models
Base = declarative_base()
# Import Base from models for SQLAlchemy 1.x compatibility
from .models import Base
def get_db() -> Generator[Session, None, None]:
@@ -68,6 +68,14 @@ def create_tables() -> None:
"""
Base.metadata.create_all(bind=engine)
# Seed default admin user after creating tables
try:
from .auth import seed_admin_user
seed_admin_user()
except ImportError:
# Handle case where auth module isn't available yet during initial import
pass
def get_database_url() -> str:
"""