feat(auth): add profile update and password change endpoints; enhance provider list handling

This commit is contained in:
JSC
2025-06-29 22:00:59 +02:00
parent 91648a858e
commit a7210a8d50
4 changed files with 129 additions and 4 deletions

View File

@@ -56,6 +56,13 @@ def get_user_from_api_token() -> dict[str, Any] | None:
user = User.find_by_api_token(api_token)
if user and user.is_active:
# Build comprehensive providers list
providers = [p.provider for p in user.oauth_providers]
if user.password_hash:
providers.append("password")
if user.api_token:
providers.append("api_token")
return {
"id": str(user.id),
"email": user.email,
@@ -64,8 +71,7 @@ def get_user_from_api_token() -> dict[str, Any] | None:
"role": user.role,
"is_active": user.is_active,
"provider": "api_token",
"providers": [p.provider for p in user.oauth_providers]
+ ["api_token"],
"providers": providers,
"plan": user.plan.to_dict() if user.plan else None,
"credits": user.credits,
}