feat(tenant): expose API Key reset from the API Info page

Add a danger-themed reset button next to the existing copy/eye buttons
on the API Info settings page. Confirmation dialog warns that the old
key is revoked immediately; on success the new plaintext key replaces
the displayed value and is auto-revealed so the user can copy it.

Backend: new POST /api/v1/tenants/:id/api-key handler that wraps the
existing TenantService.UpdateAPIKey; access is gated by the same
authorizeTenantAccess check as other tenant endpoints. The handler
returns the freshly generated plaintext key, while the encrypted form
is persisted to the database.

Frontend: new resetTenantApiKey API client, reset button + confirm
dialog wiring in ApiInfo.vue, plus matching i18n entries for zh-CN,
en-US, ko-KR, and ru-RU.
This commit is contained in:
wizardchen
2026-04-29 20:00:46 +08:00
committed by lyingbug
parent cbdfba0075
commit 7fcd92994b
8 changed files with 150 additions and 3 deletions
+1
View File
@@ -369,6 +369,7 @@ func RegisterTenantRoutes(r *gin.RouterGroup, handler *handler.TenantHandler) {
tenantRoutes.GET("/:id", handler.GetTenant)
tenantRoutes.PUT("/:id", handler.UpdateTenant)
tenantRoutes.DELETE("/:id", handler.DeleteTenant)
tenantRoutes.POST("/:id/api-key", handler.ResetAPIKey)
tenantRoutes.GET("", handler.ListTenants)
// Generic KV configuration management (tenant-level)