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
+9 -1
View File
@@ -1391,6 +1391,13 @@ export default {
copyUrlTitle: 'Скопировать URL API',
urlCopySuccess: 'URL API скопирован в буфер обмена',
copyTitle: 'Скопировать API Key',
resetTitle: 'Сбросить API Key',
resetConfirmTitle: 'Сбросить API Key?',
resetConfirmBody: 'После сброса прежний API Key немедленно перестаёт действовать. Все приложения, SDK и скрипты, использующие старый ключ, должны быть переведены на новый ключ. Это действие нельзя отменить.',
resetConfirmOk: 'Сбросить',
resetConfirmCancel: 'Отмена',
resetSuccess: 'API Key сброшен; новый ключ показан в поле выше',
resetFailed: 'Не удалось сбросить API Key',
docLabel: 'Документация API',
docDescription: 'Ознакомьтесь с полной документацией и примерами API,',
openDoc: 'Открыть документацию',
@@ -1499,7 +1506,8 @@ export default {
},
tenant: {
listFailed: 'Не удалось получить список тенантов',
searchFailed: 'Не удалось выполнить поиск тенантов'
searchFailed: 'Не удалось выполнить поиск тенантов',
resetApiKeyFailed: 'Не удалось сбросить API Key'
},
initialization: {
checkFailed: 'Проверка не пройдена',