bitwarden-estensione-browser/apps/web/src/app/settings/deauthorize-sessions.compon...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.6 KiB
TypeScript
Raw Normal View History

import { Component } from "@angular/core";
2018-06-21 23:14:36 +02:00
2022-06-14 17:10:53 +02:00
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
import { Verification } from "@bitwarden/common/types/verification";
2018-06-21 23:14:36 +02:00
@Component({
selector: "app-deauthorize-sessions",
templateUrl: "deauthorize-sessions.component.html",
})
export class DeauthorizeSessionsComponent {
masterPassword: Verification;
2018-06-21 23:14:36 +02:00
formPromise: Promise<any>;
constructor(
private apiService: ApiService,
private i18nService: I18nService,
2021-12-07 20:41:45 +01:00
private platformUtilsService: PlatformUtilsService,
private userVerificationService: UserVerificationService,
private messagingService: MessagingService,
private logService: LogService
) {}
2018-06-21 23:14:36 +02:00
async submit() {
try {
this.formPromise = this.userVerificationService
.buildRequest(this.masterPassword)
.then((request) => this.apiService.postSecurityStamp(request));
2018-06-21 23:14:36 +02:00
await this.formPromise;
2021-12-07 20:41:45 +01:00
this.platformUtilsService.showToast(
"success",
this.i18nService.t("sessionsDeauthorized"),
2018-06-21 23:14:36 +02:00
this.i18nService.t("logBackIn")
);
this.messagingService.send("logout");
} catch (e) {
this.logService.error(e);
2018-06-21 23:14:36 +02:00
}
2021-12-17 15:57:11 +01:00
}
2018-06-21 23:14:36 +02:00
}