mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
move sync to post login action
This commit is contained in:
@@ -16,13 +16,14 @@ export class LoginComponent {
|
|||||||
masterPassword: string = '';
|
masterPassword: string = '';
|
||||||
showPassword: boolean = false;
|
showPassword: boolean = false;
|
||||||
formPromise: Promise<AuthResult>;
|
formPromise: Promise<AuthResult>;
|
||||||
|
onSuccessfullLogin: () => Promise<any>;
|
||||||
|
|
||||||
protected twoFactorRoute = '2fa';
|
protected twoFactorRoute = '2fa';
|
||||||
protected successRoute = 'vault';
|
protected successRoute = 'vault';
|
||||||
|
|
||||||
constructor(protected authService: AuthService, protected router: Router,
|
constructor(protected authService: AuthService, protected router: Router,
|
||||||
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
||||||
protected i18nService: I18nService, protected syncService: SyncService) { }
|
protected i18nService: I18nService) { }
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.email == null || this.email === '') {
|
if (this.email == null || this.email === '') {
|
||||||
@@ -48,7 +49,9 @@ export class LoginComponent {
|
|||||||
this.analytics.eventTrack.next({ action: 'Logged In To Two-step' });
|
this.analytics.eventTrack.next({ action: 'Logged In To Two-step' });
|
||||||
this.router.navigate([this.twoFactorRoute]);
|
this.router.navigate([this.twoFactorRoute]);
|
||||||
} else {
|
} else {
|
||||||
this.syncService.fullSync(true);
|
if (this.onSuccessfullLogin != null) {
|
||||||
|
this.onSuccessfullLogin();
|
||||||
|
}
|
||||||
this.analytics.eventTrack.next({ action: 'Logged In' });
|
this.analytics.eventTrack.next({ action: 'Logged In' });
|
||||||
this.router.navigate([this.successRoute]);
|
this.router.navigate([this.successRoute]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
twoFactorEmail: string = null;
|
twoFactorEmail: string = null;
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
emailPromise: Promise<any>;
|
emailPromise: Promise<any>;
|
||||||
|
onSuccessfullLogin: () => Promise<any>;
|
||||||
|
|
||||||
protected loginRoute = 'login';
|
protected loginRoute = 'login';
|
||||||
protected successRoute = 'vault';
|
protected successRoute = 'vault';
|
||||||
@@ -44,8 +45,8 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
constructor(protected authService: AuthService, protected router: Router,
|
constructor(protected authService: AuthService, protected router: Router,
|
||||||
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
||||||
protected i18nService: I18nService, protected apiService: ApiService,
|
protected i18nService: I18nService, protected apiService: ApiService,
|
||||||
protected platformUtilsService: PlatformUtilsService, protected syncService: SyncService,
|
protected platformUtilsService: PlatformUtilsService, protected win: Window,
|
||||||
protected win: Window, protected environmentService: EnvironmentService) {
|
protected environmentService: EnvironmentService) {
|
||||||
this.u2fSupported = this.platformUtilsService.supportsU2f(win);
|
this.u2fSupported = this.platformUtilsService.supportsU2f(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +165,9 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
try {
|
try {
|
||||||
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
|
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.syncService.fullSync(true);
|
if (this.onSuccessfullLogin != null) {
|
||||||
|
this.onSuccessfullLogin();
|
||||||
|
}
|
||||||
this.analytics.eventTrack.next({ action: 'Logged In From Two-step' });
|
this.analytics.eventTrack.next({ action: 'Logged In From Two-step' });
|
||||||
this.router.navigate([this.successRoute]);
|
this.router.navigate([this.successRoute]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user