From dec3cd74aaa97e79eeecd73ca83defbd8a493ac9 Mon Sep 17 00:00:00 2001 From: Szilard Szaloki Date: Wed, 1 Apr 2026 16:28:24 -0600 Subject: [PATCH] Account: disallow leading/trailing whitespace in passwords (#35133) --- components/brave_account/resources/BUILD.gn | 2 - .../resources/brave_account_common.css | 28 ++++++++ .../brave_account_create_dialog.html.ts | 2 + .../resources/brave_account_create_dialog.ts | 2 + .../resources/brave_account_email_input.css | 18 ----- .../brave_account_email_input.html.ts | 5 +- .../resources/brave_account_email_input.ts | 2 +- .../brave_account_password_input.css | 25 ------- .../brave_account_password_input.html.ts | 67 ++++++++++++------- .../resources/brave_account_password_input.ts | 50 +++++++++----- .../brave_account_sign_in_dialog.html.ts | 1 + .../resources/brave_account_sign_in_dialog.ts | 6 +- .../resources/brave_account_strings.grdp | 3 + 13 files changed, 117 insertions(+), 94 deletions(-) delete mode 100644 components/brave_account/resources/brave_account_email_input.css delete mode 100644 components/brave_account/resources/brave_account_password_input.css diff --git a/components/brave_account/resources/BUILD.gn b/components/brave_account/resources/BUILD.gn index 067b1f0eaa7..f6fdf0f743a 100644 --- a/components/brave_account/resources/BUILD.gn +++ b/components/brave_account/resources/BUILD.gn @@ -47,12 +47,10 @@ build_webui("build") { css_files = [ "brave_account_common.css", "brave_account_dialog.css", - "brave_account_email_input.css", "brave_account_entry_dialog.css", "brave_account_forgot_password_dialog.css", "brave_account_otp_input.css", "brave_account_password_icons.css", - "brave_account_password_input.css", "brave_account_password_strength_meter.css", "brave_account_sign_in_dialog.css", ] diff --git a/components/brave_account/resources/brave_account_common.css b/components/brave_account/resources/brave_account_common.css index a12573a5405..9ba7be6d787 100644 --- a/components/brave_account/resources/brave_account_common.css +++ b/components/brave_account/resources/brave_account_common.css @@ -7,6 +7,21 @@ * #type=style-lit * #css_wrapper_metadata_end */ +@keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +.label-container { + display: flex; + justify-content: space-between; + width: 100%; +} + .label { color: var(--leo-color-text-primary); font: var(--leo-font-small-semibold); @@ -43,9 +58,22 @@ leo-input:focus:has(.error) { } .dropdown-content { + --leo-icon-size: var(--leo-icon-xs); align-self: end; + animation: fadeIn 300ms ease-in-out; + display: flex; + font: var(--leo-font-small-regular); + gap: var(--leo-spacing-s); min-height: 0; + leo-icon { + /* Slight vertical tweak to align icon with first text line. + align-items: center on .dropdown-content works for single-line text, + but misaligns when wrapping. Offset is based on the difference between + the line-height and icon size. */ + margin-top: calc((1lh - var(--leo-icon-size)) / 2); + } + leo-icon[name='check-circle-filled'] { --leo-icon-color: var(--leo-color-systemfeedback-success-icon); diff --git a/components/brave_account/resources/brave_account_create_dialog.html.ts b/components/brave_account/resources/brave_account_create_dialog.html.ts index 331a281189c..bd3ac5c554a 100644 --- a/components/brave_account/resources/brave_account_create_dialog.html.ts +++ b/components/brave_account/resources/brave_account_create_dialog.html.ts @@ -42,6 +42,7 @@ export function getHtml(this: BraveAccountCreateDialogElement) { placeholder="$i18n{BRAVE_ACCOUNT_PASSWORD_INPUT_PLACEHOLDER}" @password-input=${(e: CustomEvent) => { this.password = e.detail.password + this.isPasswordValid = e.detail.isValid }} > @@ -59,6 +60,7 @@ export function getHtml(this: BraveAccountCreateDialogElement) { -