From c35576deb8d3fa06959157eebff4603ce3d21a9b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 13 Oct 2018 00:11:06 -0400 Subject: [PATCH] ns updates and overloads --- src/angular/components/login.component.ts | 7 ++++++- src/misc/utils.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/angular/components/login.component.ts b/src/angular/components/login.component.ts index d5a19526b1..86e0e66a7c 100644 --- a/src/angular/components/login.component.ts +++ b/src/angular/components/login.component.ts @@ -27,6 +27,7 @@ export class LoginComponent implements OnInit { formPromise: Promise; onSuccessfulLogin: () => Promise; onSuccessfulLoginNavigate: () => Promise; + onSuccessfulLoginTwoFactorNavigate: () => Promise; protected twoFactorRoute = '2fa'; protected successRoute = 'vault'; @@ -79,7 +80,11 @@ export class LoginComponent implements OnInit { } if (response.twoFactor) { this.platformUtilsService.eventTrack('Logged In To Two-step'); - this.router.navigate([this.twoFactorRoute]); + if (this.onSuccessfulLoginTwoFactorNavigate != null) { + this.onSuccessfulLoginTwoFactorNavigate(); + } else { + this.router.navigate([this.twoFactorRoute]); + } } else { if (this.onSuccessfulLogin != null) { this.onSuccessfulLogin(); diff --git a/src/misc/utils.ts b/src/misc/utils.ts index 6ff46f15cd..0b5c86dc25 100644 --- a/src/misc/utils.ts +++ b/src/misc/utils.ts @@ -22,7 +22,7 @@ export class Utils { Utils.isBrowser = typeof window !== 'undefined'; Utils.isNativeScript = !Utils.isNode && !Utils.isBrowser; Utils.isMobileBrowser = Utils.isBrowser && this.isMobile(window); - Utils.global = Utils.isNativeScript ? new Object() : (Utils.isNode && !Utils.isBrowser ? global : window); + Utils.global = Utils.isNativeScript ? global : (Utils.isNode && !Utils.isBrowser ? global : window); } static fromB64ToArray(str: string): Uint8Array {