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, )