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} +