From 6ffaeae331ae870ce8bd627e99b1ef54e31096e2 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:39:43 -0700 Subject: [PATCH] add dynamic anon-layout wrapper data --- apps/web/src/locales/en/messages.json | 3 +++ libs/auth/src/angular/icons/index.ts | 3 +++ libs/auth/src/angular/icons/wave.icon.ts | 11 +++++++++++ libs/auth/src/angular/login/login.component.ts | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 libs/auth/src/angular/icons/wave.icon.ts diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index c2e1470be4..edf09be183 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -803,6 +803,9 @@ "useSingleSignOn": { "message": "Use single sign-on" }, + "welcomeBack": { + "message": "Welcome back" + }, "invalidPasskeyPleaseTryAgain": { "message": "Invalid Passkey. Please try again." }, diff --git a/libs/auth/src/angular/icons/index.ts b/libs/auth/src/angular/icons/index.ts index f502fbe5f3..3bdbbe4a18 100644 --- a/libs/auth/src/angular/icons/index.ts +++ b/libs/auth/src/angular/icons/index.ts @@ -1,4 +1,7 @@ export * from "./bitwarden-logo.icon"; export * from "./bitwarden-shield.icon"; export * from "./lock.icon"; +export * from "./registration-check-email.icon"; +export * from "./registration-expired-link.icon"; export * from "./user-verification-biometrics-fingerprint.icon"; +export * from "./wave.icon"; diff --git a/libs/auth/src/angular/icons/wave.icon.ts b/libs/auth/src/angular/icons/wave.icon.ts new file mode 100644 index 0000000000..72f7c8bb91 --- /dev/null +++ b/libs/auth/src/angular/icons/wave.icon.ts @@ -0,0 +1,11 @@ +import { svgIcon } from "@bitwarden/components"; + +export const WaveIcon = svgIcon` + + + + + + + +`; diff --git a/libs/auth/src/angular/login/login.component.ts b/libs/auth/src/angular/login/login.component.ts index c3821ea014..cf2cedb3be 100644 --- a/libs/auth/src/angular/login/login.component.ts +++ b/libs/auth/src/angular/login/login.component.ts @@ -39,6 +39,9 @@ import { ToastService, } from "@bitwarden/components"; +import { AnonLayoutWrapperDataService } from "../anon-layout/anon-layout-wrapper-data.service"; +import { WaveIcon } from "../icons"; + import { LoginService } from "./login.service"; const BroadcasterSubscriptionId = "LoginComponent"; @@ -68,6 +71,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy { @Input() captchaSiteKey: string = null; private destroy$ = new Subject(); + readonly Icons = { WaveIcon }; captcha: CaptchaIFrame; captchaToken: string = null; @@ -79,7 +83,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy { validatedEmail = false; formGroup = this.formBuilder.group({ - email: ["", { validators: [Validators.required, Validators.email], updateOn: "submit" }], + email: ["", [Validators.required, Validators.email]], masterPassword: [ "", [Validators.required, Validators.minLength(Utils.originalMinimumPasswordLength)], @@ -111,6 +115,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy { constructor( private activatedRoute: ActivatedRoute, + private anonLayoutWrapperDataService: AnonLayoutWrapperDataService, private appIdService: AppIdService, private broadcasterService: BroadcasterService, private devicesApiService: DevicesApiServiceAbstraction, @@ -330,6 +335,16 @@ export class LoginComponentV2 implements OnInit, OnDestroy { if (emailValid) { this.toggleValidateEmail(true); await this.getLoginWithDevice(this.loggedEmail); + + this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({ + pageTitle: "welcomeBack", + pageSubtitle: { + // TODO-rr-bw: add an icon that takes the user back + subtitle: `(todo: back btn) ${this.loggedEmail}`, + translate: false, + }, + pageIcon: this.Icons.WaveIcon, + }); } }