diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 578caf9ad5..35bd7b3a63 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -6174,6 +6174,10 @@ "message": "Access tokens revoked", "description": "Toast message after deleting one or multiple access tokens." }, + "noAccessTokenSelected": { + "message": "No access token selected to revoke", + "description": "Toast error message after trying to delete access tokens but not selecting any access tokens." + }, "submenu": { "message": "Submenu" }, diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html index efcb70a0ef..632e10c8c7 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html @@ -87,7 +87,9 @@ diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts index b9a8a88b53..2355f3049f 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts @@ -4,6 +4,7 @@ import { combineLatestWith, Observable, startWith, switchMap } from "rxjs"; import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; +import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { UserVerificationPromptComponent } from "@bitwarden/web-vault/app/components/user-verification-prompt.component"; @@ -27,7 +28,8 @@ export class AccessTokenComponent implements OnInit { private accessService: AccessService, private dialogService: DialogServiceAbstraction, private modalService: ModalService, - private platformUtilsService: PlatformUtilsService + private platformUtilsService: PlatformUtilsService, + private i18nService: I18nService ) {} ngOnInit() { @@ -43,6 +45,15 @@ export class AccessTokenComponent implements OnInit { } protected async revoke(tokens: AccessTokenView[]) { + if (!tokens?.length) { + this.platformUtilsService.showToast( + "error", + null, + this.i18nService.t("noAccessTokenSelected") + ); + return; + } + if (!(await this.verifyUser())) { return; } @@ -52,7 +63,7 @@ export class AccessTokenComponent implements OnInit { tokens.map((t) => t.id) ); - this.platformUtilsService.showToast("success", null, "Access tokens revoked."); + this.platformUtilsService.showToast("success", null, this.i18nService.t("accessTokenRevoked")); } protected openNewAccessTokenDialog() {