From c1613f79cd2604b97f710811663df7a983fb333a Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Fri, 24 Sep 2021 08:34:09 -0500 Subject: [PATCH] [Reset Password v1] Refactor ForcePasswordReset flow (#2063) * [Reset Password v1] Refactor ForcePasswordReset flow * Update jslib --- src/popup/accounts/login.component.ts | 9 ++------- src/popup/accounts/set-password.component.ts | 7 ------- src/popup/accounts/sso.component.ts | 11 +---------- src/popup/accounts/two-factor.component.ts | 12 +++--------- 4 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/popup/accounts/login.component.ts b/src/popup/accounts/login.component.ts index ebace90a8c..08edd398de 100644 --- a/src/popup/accounts/login.component.ts +++ b/src/popup/accounts/login.component.ts @@ -10,7 +10,6 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { StateService } from 'jslib-common/abstractions/state.service'; import { StorageService } from 'jslib-common/abstractions/storage.service'; import { SyncService } from 'jslib-common/abstractions/sync.service'; -import { UserService } from 'jslib-common/abstractions/user.service'; import { LoginComponent as BaseLoginComponent } from 'jslib-angular/components/login.component'; @@ -24,14 +23,10 @@ export class LoginComponent extends BaseLoginComponent { protected stateService: StateService, protected environmentService: EnvironmentService, protected passwordGenerationService: PasswordGenerationService, protected cryptoFunctionService: CryptoFunctionService, storageService: StorageService, - syncService: SyncService, private userService: UserService) { + syncService: SyncService) { super(authService, router, platformUtilsService, i18nService, stateService, environmentService, passwordGenerationService, cryptoFunctionService, storageService); super.onSuccessfulLogin = async () => { - await syncService.fullSync(true).then(async () => { - if (await this.userService.getForcePasswordReset()) { - this.router.navigate(['update-temp-password']); - } - }); + await syncService.fullSync(true); }; super.successRoute = '/tabs/vault'; } diff --git a/src/popup/accounts/set-password.component.ts b/src/popup/accounts/set-password.component.ts index 8e795f9fe5..143bb864c8 100644 --- a/src/popup/accounts/set-password.component.ts +++ b/src/popup/accounts/set-password.component.ts @@ -31,13 +31,6 @@ export class SetPasswordComponent extends BaseSetPasswordComponent { syncService: SyncService, route: ActivatedRoute) { super(i18nService, cryptoService, messagingService, userService, passwordGenerationService, platformUtilsService, policyService, router, apiService, syncService, route); - super.onSuccessfulChangePassword = async () => { - if (await this.userService.getForcePasswordReset()) { - this.router.navigate(['update-temp-password']); - } else { - this.router.navigate([this.successRoute]); - } - }; } get masterPasswordScoreWidth() { diff --git a/src/popup/accounts/sso.component.ts b/src/popup/accounts/sso.component.ts index 6536e67068..34b3a77c01 100644 --- a/src/popup/accounts/sso.component.ts +++ b/src/popup/accounts/sso.component.ts @@ -15,7 +15,6 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { StateService } from 'jslib-common/abstractions/state.service'; import { StorageService } from 'jslib-common/abstractions/storage.service'; import { SyncService } from 'jslib-common/abstractions/sync.service'; -import { UserService } from 'jslib-common/abstractions/user.service'; import { SsoComponent as BaseSsoComponent } from 'jslib-angular/components/sso.component'; import { BrowserApi } from '../../browser/browserApi'; @@ -30,7 +29,7 @@ export class SsoComponent extends BaseSsoComponent { storageService: StorageService, stateService: StateService, platformUtilsService: PlatformUtilsService, apiService: ApiService, cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService, - syncService: SyncService, environmentService: EnvironmentService, private userService: UserService) { + syncService: SyncService, environmentService: EnvironmentService) { super(authService, router, i18nService, route, storageService, stateService, platformUtilsService, apiService, cryptoFunctionService, environmentService, passwordGenerationService); @@ -45,13 +44,5 @@ export class SsoComponent extends BaseSsoComponent { const thisWindow = window.open('', '_self'); thisWindow.close(); }; - - super.onSuccessfulLoginNavigate = async () => { - if (await this.userService.getForcePasswordReset()) { - this.router.navigate(['update-temp-password']); - } else { - this.router.navigate([this.successRoute]); - } - }; } } diff --git a/src/popup/accounts/two-factor.component.ts b/src/popup/accounts/two-factor.component.ts index 65f210dc62..7850daa5d9 100644 --- a/src/popup/accounts/two-factor.component.ts +++ b/src/popup/accounts/two-factor.component.ts @@ -20,7 +20,6 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { StateService } from 'jslib-common/abstractions/state.service'; import { StorageService } from 'jslib-common/abstractions/storage.service'; import { SyncService } from 'jslib-common/abstractions/sync.service'; -import { UserService } from 'jslib-common/abstractions/user.service'; import { BroadcasterService } from 'jslib-angular/services/broadcaster.service'; @@ -45,16 +44,11 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { environmentService: EnvironmentService, private ngZone: NgZone, private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef, private popupUtilsService: PopupUtilsService, stateService: StateService, - storageService: StorageService, route: ActivatedRoute, private messagingService: MessagingService, - private userService: UserService) { + storageService: StorageService, route: ActivatedRoute, private messagingService: MessagingService) { super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService, stateService, storageService, route); - super.onSuccessfulLogin = async () => { - return syncService.fullSync(true).then(async () => { - if (await this.userService.getForcePasswordReset()) { - this.router.navigate(['update-temp-password']); - } - }); + super.onSuccessfulLogin = () => { + return syncService.fullSync(true); }; super.successRoute = '/tabs/vault'; this.webAuthnNewTab = this.platformUtilsService.isFirefox() || this.platformUtilsService.isSafari();