Bind the password form (#15748)

* Bind the password form

* Type fixes
This commit is contained in:
melohagan 2025-03-14 14:24:07 +00:00 committed by GitHub
parent 59fe147863
commit e705a23b74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -79,6 +79,7 @@
<Heading size="M">Reset your password</Heading> <Heading size="M">Reset your password</Heading>
<Body size="M">Must contain at least 12 characters</Body> <Body size="M">Must contain at least 12 characters</Body>
<PasswordRepeatInput <PasswordRepeatInput
bind:passwordForm={form}
bind:password bind:password
bind:error={passwordError} bind:error={passwordError}
minLength={$admin.passwordMinLength || 12} minLength={$admin.passwordMinLength || 12}

View File

@ -1,13 +1,14 @@
<script> <script lang="ts">
import { FancyForm, FancyInput } from "@budibase/bbui" import { FancyForm, FancyInput } from "@budibase/bbui"
import { createValidationStore, requiredValidator } from "../utils/validation" import { createValidationStore, requiredValidator } from "../utils/validation"
export let password export let passwordForm: FancyForm | undefined = undefined
export let error export let password: string
export let error: string
export let minLength = "12" export let minLength = "12"
const validatePassword = value => { const validatePassword = (value: string | undefined) => {
if (!value || value.length < minLength) { if (!value || value.length < parseInt(minLength)) {
return `Please enter at least ${minLength} characters. We recommend using machine generated or random passwords.` return `Please enter at least ${minLength} characters. We recommend using machine generated or random passwords.`
} }
return null return null
@ -35,7 +36,7 @@
firstPasswordError firstPasswordError
</script> </script>
<FancyForm> <FancyForm bind:this={passwordForm}>
<FancyInput <FancyInput
label="Password" label="Password"
type="password" type="password"