mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Route on switchAccountFinish Message (#7422)
This commit is contained in:
parent
fb0e8fc2ff
commit
f2eea12b4f
@ -1,9 +1,27 @@
|
|||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
|
import { firstValueFrom } from "rxjs";
|
||||||
|
|
||||||
import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from "@bitwarden/angular/auth/components/update-temp-password.component";
|
import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from "@bitwarden/angular/auth/components/update-temp-password.component";
|
||||||
|
|
||||||
|
import { postLogoutMessageListener$ } from "./utils/post-logout-message-listener";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-update-temp-password",
|
selector: "app-update-temp-password",
|
||||||
templateUrl: "update-temp-password.component.html",
|
templateUrl: "update-temp-password.component.html",
|
||||||
})
|
})
|
||||||
export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent {}
|
export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent {
|
||||||
|
onSuccessfulChangePassword: () => Promise<void> = this.doOnSuccessfulChangePassword.bind(this);
|
||||||
|
|
||||||
|
private async doOnSuccessfulChangePassword() {
|
||||||
|
// start listening for "switchAccountFinish" or "doneLoggingOut"
|
||||||
|
const messagePromise = firstValueFrom(postLogoutMessageListener$);
|
||||||
|
this.messagingService.send("logout");
|
||||||
|
// wait for messages
|
||||||
|
const command = await messagePromise;
|
||||||
|
|
||||||
|
// doneLoggingOut already has a message handler that will navigate us
|
||||||
|
if (command === "switchAccountFinish") {
|
||||||
|
this.router.navigate(["/"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
|
|||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private userVerificationService: UserVerificationService,
|
private userVerificationService: UserVerificationService,
|
||||||
private router: Router,
|
protected router: Router,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
|
Loading…
Reference in New Issue
Block a user