use actix_web::{HttpResponse, web}; use crate::api::response::{ApiEmptyResponse, ApiErrorResponse}; use crate::error::AppError; use crate::service::AppService; use crate::service::auth::change_password::ChangePasswordParams; use crate::session::Session; #[utoipa::path( post, path = "/api/v1/auth/password/change", tag = "Auth", operation_id = "authChangePassword", request_body(content = ChangePasswordParams, description = "Password change parameters (passwords encrypted with session RSA public key)", content_type = "application/json"), responses( (status = 200, description = "Password changed successfully", body = ApiEmptyResponse), (status = 400, description = "Invalid password", body = ApiErrorResponse), (status = 401, description = "Authentication required", body = ApiErrorResponse), (status = 500, description = "Internal server error", body = ApiErrorResponse), ), security(("session_cookie" = [])) )] pub async fn change_password( service: web::Data, session: Session, params: web::Json, ) -> Result { service .auth .auth_change_password(&session, params.into_inner()) .await?; Ok(HttpResponse::Ok().json(ApiEmptyResponse::ok("password changed successfully"))) }