enable change password

This commit is contained in:
2026-09-10 09:47:57 +08:00
parent f10915e020
commit c841aa091d
5 changed files with 70 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ from .models import (
SentenceBoundaryDocument,
SentenceExplanationRequest,
SentenceExplanationResponse,
PasswordResetRequest,
SentenceTextUpdate,
UserDubShareSummary,
SsoExchangeRequest,
@@ -441,6 +442,19 @@ def create_app(
raise HTTPException(status_code=404, detail="User was not found.")
return Response(status_code=204)
@application.put(
"/api/v1/admin/users/password",
status_code=204,
dependencies=[Depends(require_admin)],
)
def reset_user_password(
payload: PasswordResetRequest,
) -> Response:
updated = video_repository.set_user_password(payload.username, payload.password)
if not updated:
raise HTTPException(status_code=404, detail="User was not found.")
return Response(status_code=204)
@application.get("/api/v1/videos", response_model=VideoListResponse)
def list_videos() -> VideoListResponse:
return VideoListResponse(