feat(api): expand API endpoints for repo, PR, user, workspace management
- Add git operation endpoints: archive, compare branches, diff, tree, repository extras - Add repo endpoints: contributors, delete fork, get branch/commit status/deploy key/invitation/member/release/tag/webhook, topics, release assets, webhook deliveries/retry - Add PR endpoints: review requests, templates - Add user endpoints: block/unblock, follow/unfollow, presence, personal access tokens, account restore - Add workspace endpoints: billing history, approvals, domains, integrations, invitations, members, webhooks, restore - Add internal API, notification API, IM API modules - Update route configuration and OpenAPI spec
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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<AppService>,
|
||||
session: Session,
|
||||
params: web::Json<ChangePasswordParams>,
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.auth
|
||||
.auth_change_password(&session, params.into_inner())
|
||||
.await?;
|
||||
Ok(HttpResponse::Ok().json(ApiEmptyResponse::ok("password changed successfully")))
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod captcha;
|
||||
pub mod change_password;
|
||||
pub mod disable_2fa;
|
||||
pub mod enable_2fa;
|
||||
pub mod get_2fa_status;
|
||||
@@ -52,6 +53,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
.route(
|
||||
"/2fa/backup-codes/regenerate",
|
||||
web::post().to(regenerate_2fa_backup_codes::handle),
|
||||
)
|
||||
.route(
|
||||
"/password/change",
|
||||
web::post().to(change_password::change_password),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user