Adds the page reachable from the username link in the header. Renders the form skeleton; the POST handler lands in the next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
738 B
Python
27 lines
738 B
Python
from flask import Blueprint, render_template, request
|
|
|
|
from l4d2web.auth import require_login
|
|
|
|
|
|
bp = Blueprint("profile", __name__)
|
|
|
|
|
|
_ERROR_MESSAGES = {
|
|
"fields_required": "Fill in all three fields.",
|
|
"mismatch": "New password and confirmation do not match.",
|
|
"too_short": "New password must be at least 8 characters.",
|
|
"empty": "New password must not be empty.",
|
|
"wrong_current": "Current password is incorrect.",
|
|
}
|
|
|
|
|
|
@bp.get("/profile")
|
|
@require_login
|
|
def profile_page() -> str:
|
|
error_key = request.args.get("error", "")
|
|
success = request.args.get("success") == "1"
|
|
return render_template(
|
|
"profile.html",
|
|
error_message=_ERROR_MESSAGES.get(error_key, ""),
|
|
success=success,
|
|
)
|