1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-05 09:10:53 +01:00

ns updates and overloads

This commit is contained in:
Kyle Spearrin 2018-10-13 00:11:06 -04:00
parent 9fa99f3a6e
commit c35576deb8
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ export class LoginComponent implements OnInit {
formPromise: Promise<AuthResult>;
onSuccessfulLogin: () => Promise<any>;
onSuccessfulLoginNavigate: () => Promise<any>;
onSuccessfulLoginTwoFactorNavigate: () => Promise<any>;
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();

View File

@ -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 {