From 5eb4cbbf5fff6ba67ccaa933a640e2381ba2b840 Mon Sep 17 00:00:00 2001 From: Patrick Pimentel Date: Fri, 27 Dec 2024 16:05:33 -0500 Subject: [PATCH] refactor(email-verification-feature-flag): [PM-7882] Email Verification Lots of fixes and removal of the register route for signup in a lot of places. --- .../src/auth/popup/home.component.html | 8 +- apps/browser/src/auth/popup/home.component.ts | 20 +++-- .../src/auth/popup/login-v1.component.html | 4 +- .../src/auth/popup/login-v1.component.ts | 3 - apps/browser/src/popup/app-routing.module.ts | 5 +- apps/desktop/src/app/app-routing.module.ts | 5 +- .../src/auth/login/login-v1.component.html | 6 +- .../src/auth/login/login-v1.component.ts | 7 +- ...families-for-enterprise-setup.component.ts | 16 ++-- .../accept/accept-emergency.component.ts | 32 ++------ .../src/app/auth/login/login-v1.component.ts | 14 +--- .../accept-organization.component.ts | 42 +++------- .../organization-invite.ts | 5 +- .../adjust-storage-dialog.component.ts | 1 - .../src/app/common/base.accept.component.ts | 26 +++--- apps/web/src/app/oss-routing.module.ts | 16 ++-- .../src/app/tools/send/access.component.ts | 25 ++---- .../send/send-access-explainer.component.html | 8 +- .../send/send-access-explainer.component.ts | 6 +- .../manage/accept-provider.component.ts | 49 ++++------- .../src/auth/components/login-v1.component.ts | 81 ++++++++++--------- .../src/auth/components/sso.component.ts | 10 +-- libs/auth/src/angular/sso/sso.component.ts | 11 +-- libs/components/src/toast/toast.component.ts | 2 +- libs/components/src/toast/toast.service.ts | 9 +++ 25 files changed, 162 insertions(+), 249 deletions(-) diff --git a/apps/browser/src/auth/popup/home.component.html b/apps/browser/src/auth/popup/home.component.html index ed395797961..c4eddd5ab4d 100644 --- a/apps/browser/src/auth/popup/home.component.html +++ b/apps/browser/src/auth/popup/home.component.html @@ -1,4 +1,4 @@ - +
diff --git a/apps/browser/src/auth/popup/home.component.ts b/apps/browser/src/auth/popup/home.component.ts index 6060ac77abe..e51d8bcf963 100644 --- a/apps/browser/src/auth/popup/home.component.ts +++ b/apps/browser/src/auth/popup/home.component.ts @@ -1,19 +1,17 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { Component, OnDestroy, OnInit, ViewChild } from "@angular/core"; import { FormBuilder, Validators } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { Subject, firstValueFrom, switchMap, takeUntil, tap } from "rxjs"; import { EnvironmentSelectorComponent } from "@bitwarden/angular/auth/components/environment-selector.component"; -import { LoginEmailServiceAbstraction, RegisterRouteService } from "@bitwarden/auth/common"; +import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ToastService } from "@bitwarden/components"; - import { AccountSwitcherService } from "./account-switching/services/account-switcher.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @Component({ selector: "app-home", @@ -30,9 +28,6 @@ export class HomeComponent implements OnInit, OnDestroy { rememberEmail: [false], }); - // TODO: remove when email verification flag is removed - registerRoute$ = this.registerRouteService.registerRoute$(); - constructor( protected platformUtilsService: PlatformUtilsService, private formBuilder: FormBuilder, @@ -40,10 +35,10 @@ export class HomeComponent implements OnInit, OnDestroy { private i18nService: I18nService, private loginEmailService: LoginEmailServiceAbstraction, private accountSwitcherService: AccountSwitcherService, - private registerRouteService: RegisterRouteService, private toastService: ToastService, private configService: ConfigService, private route: ActivatedRoute, + private logService: LogService, ) {} async ngOnInit(): Promise { @@ -122,6 +117,15 @@ export class HomeComponent implements OnInit, OnDestroy { } async setLoginEmailValues() { + if (!this.formGroup.value.rememberEmail || !this.formGroup.value.email) { + this.logService.warning( + `Failed to setLoginEmailValues due to null value for either: + \n\tformGroup.value.rememberEmail: ${this.formGroup.value.rememberEmail} + \n\tformGroup.value.email: ${this.formGroup.value.email}`, + ); + return; + } + // Note: Browser saves email settings here instead of the login component this.loginEmailService.setRememberEmail(this.formGroup.value.rememberEmail); await this.loginEmailService.setLoginEmail(this.formGroup.value.email); diff --git a/apps/browser/src/auth/popup/login-v1.component.html b/apps/browser/src/auth/popup/login-v1.component.html index 145a9cbc754..9fb90199f22 100644 --- a/apps/browser/src/auth/popup/login-v1.component.html +++ b/apps/browser/src/auth/popup/login-v1.component.html @@ -1,4 +1,4 @@ -
+

{{ "logIn" | i18n }} @@ -60,7 +60,7 @@