[SM-664] Checking if the user has selected access tokens to revoke, if not err… (#5299)
* Checking if the user has selected access tokens to revoke, if not error message * change messaging * SM-664: Refactor revoke function and make the bwi-minus-circle red --------- Co-authored-by: Colton Hurst <colton@coltonhurst.com>
This commit is contained in:
parent
c5674080ef
commit
e97390ba3f
|
@ -6174,6 +6174,10 @@
|
||||||
"message": "Access tokens revoked",
|
"message": "Access tokens revoked",
|
||||||
"description": "Toast message after deleting one or multiple access tokens."
|
"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": {
|
"submenu": {
|
||||||
"message": "Submenu"
|
"message": "Submenu"
|
||||||
},
|
},
|
||||||
|
|
|
@ -87,7 +87,9 @@
|
||||||
|
|
||||||
<bit-menu #tableMenu>
|
<bit-menu #tableMenu>
|
||||||
<button type="button" bitMenuItem (click)="revokeSelected()">
|
<button type="button" bitMenuItem (click)="revokeSelected()">
|
||||||
|
<span class="tw-text-danger">
|
||||||
<i class="bwi bwi-fw bwi-minus-circle" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-minus-circle" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">{{ "revokeAccessTokens" | i18n }}</span>
|
{{ "revokeAccessTokens" | i18n }}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { combineLatestWith, Observable, startWith, switchMap } from "rxjs";
|
||||||
|
|
||||||
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
|
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
|
||||||
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
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 { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { UserVerificationPromptComponent } from "@bitwarden/web-vault/app/components/user-verification-prompt.component";
|
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 accessService: AccessService,
|
||||||
private dialogService: DialogServiceAbstraction,
|
private dialogService: DialogServiceAbstraction,
|
||||||
private modalService: ModalService,
|
private modalService: ModalService,
|
||||||
private platformUtilsService: PlatformUtilsService
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private i18nService: I18nService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -43,6 +45,15 @@ export class AccessTokenComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async revoke(tokens: AccessTokenView[]) {
|
protected async revoke(tokens: AccessTokenView[]) {
|
||||||
|
if (!tokens?.length) {
|
||||||
|
this.platformUtilsService.showToast(
|
||||||
|
"error",
|
||||||
|
null,
|
||||||
|
this.i18nService.t("noAccessTokenSelected")
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(await this.verifyUser())) {
|
if (!(await this.verifyUser())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +63,7 @@ export class AccessTokenComponent implements OnInit {
|
||||||
tokens.map((t) => t.id)
|
tokens.map((t) => t.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.platformUtilsService.showToast("success", null, "Access tokens revoked.");
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("accessTokenRevoked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected openNewAccessTokenDialog() {
|
protected openNewAccessTokenDialog() {
|
||||||
|
|
Loading…
Reference in New Issue