From 648a46eb9fcf1d51f8248b0384e633079ca4f6ea Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Sat, 18 Apr 2026 00:55:54 +0530 Subject: [PATCH] Show inline password requirements with realtime validation --- .../components/PasswordRequirements.svelte | 29 ++++++++++++++++++ .../components/PasswordResetConfirm.svelte | 9 ++++-- src/app/components/SignUpEmail.svelte | 9 ++++-- src/app/util/password.ts | 30 +++++++++++++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 src/app/components/PasswordRequirements.svelte create mode 100644 src/app/util/password.ts diff --git a/src/app/components/PasswordRequirements.svelte b/src/app/components/PasswordRequirements.svelte new file mode 100644 index 00000000..fa6945f4 --- /dev/null +++ b/src/app/components/PasswordRequirements.svelte @@ -0,0 +1,29 @@ + + +
+

Password requirements

+ +
diff --git a/src/app/components/PasswordResetConfirm.svelte b/src/app/components/PasswordResetConfirm.svelte index 076144d1..2cee602e 100644 --- a/src/app/components/PasswordResetConfirm.svelte +++ b/src/app/components/PasswordResetConfirm.svelte @@ -16,6 +16,8 @@ import ModalTitle from "@lib/components/ModalTitle.svelte" import ModalSubtitle from "@lib/components/ModalSubtitle.svelte" import ModalFooter from "@lib/components/ModalFooter.svelte" + import PasswordRequirements from "@app/components/PasswordRequirements.svelte" + import {getPasswordValidationError} from "@app/util/password" import {loginWithPomade, deleteCurrentPomadeSession} from "@app/util/pomade" import {clearModals} from "@app/util/modal" import {pushToast} from "@app/util/toast" @@ -31,10 +33,12 @@ const back = () => history.back() const onSubmit = async () => { - if (password.trim().length < 12) { + const passwordError = getPasswordValidationError(password) + + if (passwordError) { return pushToast({ theme: "error", - message: "Password must be at least 12 characters long.", + message: passwordError, }) } @@ -104,6 +108,7 @@ {/snippet} +