Function change_password

Source
pub async fn change_password(
    __arg0: State<AppState>,
    __arg1: AuthUser,
    __arg2: Json<ChangePasswordRequest>,
) -> impl IntoResponse
Expand description

POST /api/auth/change_password

Change the password for an authenticated user.

§Request Body

{
  "current_password": "OldPassword123",
  "new_password": "NewSecurePassword456"
}

§Responses

  • 200 OK
{
  "success": true,
  "data": null,
  "message": "Password changed successfully."
}
  • 400 Bad Request (validation failure)
{
  "success": false,
  "message": "Password must be at least 8 characters"
}
  • 401 Unauthorized (invalid current password)
{
  "success": false,
  "message": "Current password is incorrect"
}
  • 401 Unauthorized (not authenticated)
{
  "success": false,
  "message": "Authentication required"
}