diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index 86977b950f3..abbe2840d6f 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -263,12 +263,6 @@ "enterYourAccountEmailAddressAndYourPasswordHintWillBeSentToYou": { "message": "Enter your account email address and your password hint will be sent to you" }, - "passwordHint": { - "message": "Password hint" - }, - "enterEmailToGetHint": { - "message": "Enter your account email address to receive your master password hint." - }, "getMasterPasswordHint": { "message": "Get master password hint" }, diff --git a/apps/browser/src/auth/popup/hint.component.html b/apps/browser/src/auth/popup/hint.component.html deleted file mode 100644 index c3d5ef3d8b7..00000000000 --- a/apps/browser/src/auth/popup/hint.component.html +++ /dev/null @@ -1,41 +0,0 @@ -
-
-
- -
-

- {{ "passwordHint" | i18n }} -

-
- -
-
-
-
-
-
- - -
-
- -
-
-
diff --git a/apps/browser/src/auth/popup/hint.component.ts b/apps/browser/src/auth/popup/hint.component.ts deleted file mode 100644 index e97236fe6a8..00000000000 --- a/apps/browser/src/auth/popup/hint.component.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component } from "@angular/core"; -import { ActivatedRoute, Router } from "@angular/router"; - -import { HintComponent as BaseHintComponent } from "@bitwarden/angular/auth/components/hint.component"; -import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { ToastService } from "@bitwarden/components"; - -@Component({ - selector: "app-hint", - templateUrl: "hint.component.html", -}) -export class HintComponent extends BaseHintComponent { - constructor( - router: Router, - platformUtilsService: PlatformUtilsService, - i18nService: I18nService, - apiService: ApiService, - logService: LogService, - private route: ActivatedRoute, - loginEmailService: LoginEmailServiceAbstraction, - toastService: ToastService, - ) { - super( - router, - i18nService, - apiService, - platformUtilsService, - logService, - loginEmailService, - toastService, - ); - - this.onSuccessfulSubmit = async () => { - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.router.navigate([this.successRoute]); - }; - } -} diff --git a/apps/browser/src/popup/app.module.ts b/apps/browser/src/popup/app.module.ts index 72117a2f900..248f10214f1 100644 --- a/apps/browser/src/popup/app.module.ts +++ b/apps/browser/src/popup/app.module.ts @@ -21,7 +21,6 @@ import { AccountComponent } from "../auth/popup/account-switching/account.compon import { CurrentAccountComponent } from "../auth/popup/account-switching/current-account.component"; import { EnvironmentComponent } from "../auth/popup/environment.component"; import { ExtensionAnonLayoutWrapperComponent } from "../auth/popup/extension-anon-layout-wrapper/extension-anon-layout-wrapper.component"; -import { HintComponent } from "../auth/popup/hint.component"; import { LoginDecryptionOptionsComponentV1 } from "../auth/popup/login-decryption-options/login-decryption-options-v1.component"; import { RemovePasswordComponent } from "../auth/popup/remove-password.component"; import { SetPasswordComponent } from "../auth/popup/set-password.component"; @@ -94,7 +93,6 @@ import "../platform/popup/locales"; ColorPasswordPipe, ColorPasswordCountPipe, EnvironmentComponent, - HintComponent, LoginDecryptionOptionsComponentV1, SetPasswordComponent, SsoComponentV1, diff --git a/apps/desktop/src/app/app.module.ts b/apps/desktop/src/app/app.module.ts index dc57fd53c07..dbb4ddeb031 100644 --- a/apps/desktop/src/app/app.module.ts +++ b/apps/desktop/src/app/app.module.ts @@ -13,7 +13,6 @@ import { DecryptionFailureDialogComponent } from "@bitwarden/vault"; import { AccessibilityCookieComponent } from "../auth/accessibility-cookie.component"; import { DeleteAccountComponent } from "../auth/delete-account.component"; import { EnvironmentComponent } from "../auth/environment.component"; -import { HintComponent } from "../auth/hint.component"; import { LoginModule } from "../auth/login/login.module"; import { RemovePasswordComponent } from "../auth/remove-password.component"; import { SetPasswordComponent } from "../auth/set-password.component"; @@ -74,7 +73,6 @@ import { SharedModule } from "./shared/shared.module"; EnvironmentComponent, FolderAddEditComponent, HeaderComponent, - HintComponent, PasswordHistoryComponent, PremiumComponent, RemovePasswordComponent, diff --git a/apps/desktop/src/auth/hint.component.html b/apps/desktop/src/auth/hint.component.html deleted file mode 100644 index a46479efee0..00000000000 --- a/apps/desktop/src/auth/hint.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
-
-

{{ "passwordHint" | i18n }}

-
-
-
- - -
-
- -
-
- - -
-
-
diff --git a/apps/desktop/src/auth/hint.component.ts b/apps/desktop/src/auth/hint.component.ts deleted file mode 100644 index 34457029257..00000000000 --- a/apps/desktop/src/auth/hint.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component } from "@angular/core"; -import { Router } from "@angular/router"; - -import { HintComponent as BaseHintComponent } from "@bitwarden/angular/auth/components/hint.component"; -import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { ToastService } from "@bitwarden/components"; - -@Component({ - selector: "app-hint", - templateUrl: "hint.component.html", -}) -export class HintComponent extends BaseHintComponent { - constructor( - router: Router, - platformUtilsService: PlatformUtilsService, - i18nService: I18nService, - apiService: ApiService, - logService: LogService, - loginEmailService: LoginEmailServiceAbstraction, - toastService: ToastService, - ) { - super( - router, - i18nService, - apiService, - platformUtilsService, - logService, - loginEmailService, - toastService, - ); - } -} diff --git a/apps/desktop/src/locales/en/messages.json b/apps/desktop/src/locales/en/messages.json index 0bc76287adb..92fe91d962c 100644 --- a/apps/desktop/src/locales/en/messages.json +++ b/apps/desktop/src/locales/en/messages.json @@ -748,12 +748,6 @@ "enterYourAccountEmailAddressAndYourPasswordHintWillBeSentToYou": { "message": "Enter your account email address and your password hint will be sent to you" }, - "passwordHint": { - "message": "Password hint" - }, - "enterEmailToGetHint": { - "message": "Enter your account email address to receive your master password hint." - }, "getMasterPasswordHint": { "message": "Get master password hint" }, diff --git a/apps/web/src/app/auth/hint.component.html b/apps/web/src/app/auth/hint.component.html deleted file mode 100644 index 9f4d76d8405..00000000000 --- a/apps/web/src/app/auth/hint.component.html +++ /dev/null @@ -1,23 +0,0 @@ -
- - {{ "emailAddress" | i18n }} - - {{ "enterEmailToGetHint" | i18n }} - -
-
- - - {{ "cancel" | i18n }} - -
-
diff --git a/apps/web/src/app/auth/hint.component.ts b/apps/web/src/app/auth/hint.component.ts deleted file mode 100644 index 5c180063084..00000000000 --- a/apps/web/src/app/auth/hint.component.ts +++ /dev/null @@ -1,64 +0,0 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore -import { Component, OnInit } from "@angular/core"; -import { FormBuilder, Validators } from "@angular/forms"; -import { Router } from "@angular/router"; - -import { HintComponent as BaseHintComponent } from "@bitwarden/angular/auth/components/hint.component"; -import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { ToastService } from "@bitwarden/components"; - -@Component({ - selector: "app-hint", - templateUrl: "hint.component.html", -}) -export class HintComponent extends BaseHintComponent implements OnInit { - formGroup = this.formBuilder.group({ - email: ["", [Validators.email, Validators.required]], - }); - - get emailFormControl() { - return this.formGroup.controls.email; - } - - constructor( - router: Router, - i18nService: I18nService, - apiService: ApiService, - platformUtilsService: PlatformUtilsService, - logService: LogService, - loginEmailService: LoginEmailServiceAbstraction, - private formBuilder: FormBuilder, - protected toastService: ToastService, - ) { - super( - router, - i18nService, - apiService, - platformUtilsService, - logService, - loginEmailService, - toastService, - ); - } - - async ngOnInit(): Promise { - await super.ngOnInit(); - this.emailFormControl.setValue(this.email); - } - - // Wrapper method to call super.submit() since properties (e.g., submit) cannot use super directly - // This is because properties are assigned per type and generally don't have access to the prototype - async superSubmit() { - await super.submit(); - } - - submit = async () => { - this.email = this.emailFormControl.value; - await this.superSubmit(); - }; -} diff --git a/apps/web/src/app/shared/loose-components.module.ts b/apps/web/src/app/shared/loose-components.module.ts index d57cc6bc1b4..f21a9338491 100644 --- a/apps/web/src/app/shared/loose-components.module.ts +++ b/apps/web/src/app/shared/loose-components.module.ts @@ -12,7 +12,6 @@ import { EventsComponent as OrgEventsComponent } from "../admin-console/organiza import { UserConfirmComponent as OrgUserConfirmComponent } from "../admin-console/organizations/manage/user-confirm.component"; import { VerifyRecoverDeleteOrgComponent } from "../admin-console/organizations/manage/verify-recover-delete-org.component"; import { AcceptFamilySponsorshipComponent } from "../admin-console/organizations/sponsorships/accept-family-sponsorship.component"; -import { HintComponent } from "../auth/hint.component"; import { RecoverDeleteComponent } from "../auth/recover-delete.component"; import { RecoverTwoFactorComponent } from "../auth/recover-two-factor.component"; import { RemovePasswordComponent } from "../auth/remove-password.component"; @@ -126,7 +125,6 @@ import { SharedModule } from "./shared.module"; EmergencyAccessViewComponent, FolderAddEditComponent, FrontendLayoutComponent, - HintComponent, OrgAddEditComponent, OrgAttachmentsComponent, OrgEventsComponent, @@ -188,7 +186,6 @@ import { SharedModule } from "./shared.module"; EmergencyAccessViewComponent, FolderAddEditComponent, FrontendLayoutComponent, - HintComponent, OrgAddEditComponent, OrganizationLayoutComponent, OrgAttachmentsComponent, diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 3e47e2b2279..0643861db1b 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -1307,12 +1307,6 @@ "enterYourAccountEmailAddressAndYourPasswordHintWillBeSentToYou": { "message": "Enter your account email address and your password hint will be sent to you" }, - "passwordHint": { - "message": "Password hint" - }, - "enterEmailToGetHint": { - "message": "Enter your account email address to receive your master password hint." - }, "getMasterPasswordHint": { "message": "Get master password hint" }, diff --git a/libs/angular/src/auth/components/hint.component.ts b/libs/angular/src/auth/components/hint.component.ts deleted file mode 100644 index 09648314a9c..00000000000 --- a/libs/angular/src/auth/components/hint.component.ts +++ /dev/null @@ -1,74 +0,0 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore -import { Directive, OnInit } from "@angular/core"; -import { Router } from "@angular/router"; -import { firstValueFrom } from "rxjs"; - -import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { PasswordHintRequest } from "@bitwarden/common/auth/models/request/password-hint.request"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { ToastService } from "@bitwarden/components"; - -@Directive() -export class HintComponent implements OnInit { - email = ""; - formPromise: Promise; - - protected successRoute = "login"; - protected onSuccessfulSubmit: () => void; - - constructor( - protected router: Router, - protected i18nService: I18nService, - protected apiService: ApiService, - protected platformUtilsService: PlatformUtilsService, - private logService: LogService, - private loginEmailService: LoginEmailServiceAbstraction, - protected toastService: ToastService, - ) {} - - async ngOnInit(): Promise { - this.email = (await firstValueFrom(this.loginEmailService.loginEmail$)) ?? ""; - } - - async submit() { - if (this.email == null || this.email === "") { - this.toastService.showToast({ - variant: "error", - title: this.i18nService.t("errorOccurred"), - message: this.i18nService.t("emailRequired"), - }); - return; - } - if (this.email.indexOf("@") === -1) { - this.toastService.showToast({ - variant: "error", - title: this.i18nService.t("errorOccurred"), - message: this.i18nService.t("invalidEmail"), - }); - return; - } - - try { - this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email)); - await this.formPromise; - this.toastService.showToast({ - variant: "success", - title: null, - message: this.i18nService.t("masterPassSent"), - }); - if (this.onSuccessfulSubmit != null) { - this.onSuccessfulSubmit(); - } else if (this.router != null) { - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.router.navigate([this.successRoute]); - } - } catch (e) { - this.logService.error(e); - } - } -}