dbdbb77daf
Struttura monorepo completa con server FastAPI e client Flask: - Server: FastAPI + SQLAlchemy 2.0 async + Alembic migrations - Client: Flask + blueprints (auth, measure, maker, statistics) - Database: docker-compose MySQL 8.0 + Alembic async config - Config: pydantic-settings, TailwindCSS, Flask-Babel i18n - Piano implementazione completo (18 sezioni, 1600 righe) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
929 B
Python
32 lines
929 B
Python
"""Authentication blueprint - login, logout, profile."""
|
|
from flask import Blueprint, render_template, request, redirect, url_for, session, flash
|
|
|
|
auth_bp = Blueprint("auth", __name__)
|
|
|
|
|
|
@auth_bp.route("/login", methods=["GET", "POST"])
|
|
def login():
|
|
"""Login page."""
|
|
if request.method == "POST":
|
|
# TODO: Implement API call to server /api/auth/login
|
|
pass
|
|
return render_template("auth/login.html")
|
|
|
|
|
|
@auth_bp.route("/logout")
|
|
def logout():
|
|
"""Logout - clear session."""
|
|
session.clear()
|
|
return redirect(url_for("auth.login"))
|
|
|
|
|
|
@auth_bp.route("/profile", methods=["GET", "POST"])
|
|
def profile():
|
|
"""User profile - change display name, language, theme."""
|
|
if "user" not in session:
|
|
return redirect(url_for("auth.login"))
|
|
if request.method == "POST":
|
|
# TODO: Implement API call to server /api/auth/me PUT
|
|
pass
|
|
return render_template("auth/profile.html")
|