From a949f499acb28ddb1ce7197fd35c0d02df957618 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 13 Jul 2018 10:49:37 -0400 Subject: [PATCH] onSuccessfulLoginNavigate for 2fa page --- src/angular/components/two-factor.component.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/angular/components/two-factor.component.ts b/src/angular/components/two-factor.component.ts index 3ebaa32126..1e676f5be1 100644 --- a/src/angular/components/two-factor.component.ts +++ b/src/angular/components/two-factor.component.ts @@ -38,7 +38,8 @@ export class TwoFactorComponent implements OnInit, OnDestroy { twoFactorEmail: string = null; formPromise: Promise; emailPromise: Promise; - onSuccessfullLogin: () => Promise; + onSuccessfulLogin: () => Promise; + onSuccessfulLoginNavigate: () => Promise; protected loginRoute = 'login'; protected successRoute = 'vault'; @@ -167,11 +168,15 @@ export class TwoFactorComponent implements OnInit, OnDestroy { try { this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember); await this.formPromise; - if (this.onSuccessfullLogin != null) { - this.onSuccessfullLogin(); + if (this.onSuccessfulLogin != null) { + this.onSuccessfulLogin(); } this.analytics.eventTrack.next({ action: 'Logged In From Two-step' }); - this.router.navigate([this.successRoute]); + if (this.onSuccessfulLoginNavigate != null) { + this.onSuccessfulLoginNavigate(); + } else { + this.router.navigate([this.successRoute]); + } } catch (e) { if (this.selectedProviderType === TwoFactorProviderType.U2f && this.u2f != null) { this.u2f.start();