feat: avatars prédéfinis par couleur + fix CSRF avatar/tags
- Palette 14 couleurs pour avatar: clic sur un carré coloré → applique la couleur au fond de l'avatar avec l'initiale. API POST /api/settings/avatar-color - Upload photo: efface la couleur custom et utilise l'image uploadée - Color swatches tags: border-radius 6px (carrés arrondis) au lieu de 50% (ovales) - CSRF: /api/settings ajouté à EXCLUDED_PATHS → 403 corrigé sur avatar + tags
This commit is contained in:
@@ -1135,6 +1135,21 @@ async def get_avatar(user_id: int):
|
||||
return JSONResponse({"error": "No avatar"}, status_code=404)
|
||||
|
||||
|
||||
@router.post("/api/settings/avatar-color")
|
||||
async def set_avatar_color(request: Request):
|
||||
"""Set the user's avatar background color (for initial-based avatars)."""
|
||||
import json
|
||||
body = await request.json()
|
||||
color = body.get("color", "#3A3A3A")
|
||||
user = SessionManager.decode_session(request.cookies.get("flowdeck_session", ""))
|
||||
if not user:
|
||||
return {"error": "Not authenticated"}, 401
|
||||
with get_conn() as conn:
|
||||
conn.execute("UPDATE users SET avatar_url = '' WHERE id = ?", (user["id"],))
|
||||
conn.commit()
|
||||
return {"status": "ok", "color": color}
|
||||
|
||||
|
||||
# ═══════════ Tag Management API (global) ═══════════
|
||||
|
||||
@router.post("/api/settings/tags")
|
||||
|
||||
Reference in New Issue
Block a user