From 42d5784ef354a4f3a875570a28111bbbaf438770 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Thu, 27 Aug 2020 13:24:38 -0500 Subject: [PATCH] [SSO] Set Password flow sync (#159) * Added sync service to set-password // Added error for CLI in set-password flow * Updated error string // added sync tracking boolean * VS code failed to saved latest change - resaving false loading --- src/angular/components/set-password.component.ts | 10 +++++++++- src/cli/commands/login.command.ts | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/angular/components/set-password.component.ts b/src/angular/components/set-password.component.ts index 4bb1932967..94fe16326d 100644 --- a/src/angular/components/set-password.component.ts +++ b/src/angular/components/set-password.component.ts @@ -7,6 +7,7 @@ import { MessagingService } from '../../abstractions/messaging.service'; import { PasswordGenerationService } from '../../abstractions/passwordGeneration.service'; import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; import { PolicyService } from '../../abstractions/policy.service'; +import { SyncService } from '../../abstractions/sync.service'; import { UserService } from '../../abstractions/user.service'; import { CipherString } from '../../models/domain/cipherString'; @@ -20,6 +21,7 @@ import { ChangePasswordComponent as BaseChangePasswordComponent } from './change import { KdfType } from '../../enums/kdfType'; export class SetPasswordComponent extends BaseChangePasswordComponent { + syncLoading: boolean = true; showPassword: boolean = false; hint: string = ''; @@ -29,11 +31,17 @@ export class SetPasswordComponent extends BaseChangePasswordComponent { constructor(i18nService: I18nService, cryptoService: CryptoService, messagingService: MessagingService, userService: UserService, passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService, policyService: PolicyService, private router: Router, - private apiService: ApiService) { + private apiService: ApiService, private syncService: SyncService) { super(i18nService, cryptoService, messagingService, userService, passwordGenerationService, platformUtilsService, policyService); } + async ngOnInit() { + await this.syncService.fullSync(true); + this.syncLoading = false; + super.ngOnInit(); + } + async setupSubmitActions() { this.kdf = KdfType.PBKDF2_SHA256; const useLowerKdf = this.platformUtilsService.isEdge() || this.platformUtilsService.isIE(); diff --git a/src/cli/commands/login.command.ts b/src/cli/commands/login.command.ts index 9d6e6bf243..acccd4f4d2 100644 --- a/src/cli/commands/login.command.ts +++ b/src/cli/commands/login.command.ts @@ -200,6 +200,11 @@ export class LoginCommand { return Response.error('Login failed.'); } + if (response.resetMasterPassword) { + return Response.error('In order to log in with SSO from the CLI, you must first log in' + + ' through the web vault to set your master password.'); + } + if (this.success != null) { const res = await this.success(); return Response.success(res);