Fix profile and password modals in portal

This commit is contained in:
Andrew Kingston 2025-03-07 16:20:23 +00:00
parent 3c44c94442
commit 790cb00be8
No known key found for this signature in database
7 changed files with 23 additions and 11 deletions

View File

@ -204,7 +204,11 @@
<ProfileModal {API} user={$auth.user} on:save={() => auth.getSelf()} />
</Modal>
<Modal bind:this={changePasswordModal}>
<ChangePasswordModal {API} on:save={() => auth.getSelf()} />
<ChangePasswordModal
{API}
passwordMinLength={$admin.passwordMinLength}
on:save={() => auth.getSelf()}
/>
</Modal>
{/if}

View File

@ -8,11 +8,10 @@
notifications,
} from "@budibase/bbui"
import { goto, params } from "@roxi/routify"
import { auth, organisation } from "@/stores/portal"
import { auth, organisation, admin } from "@/stores/portal"
import Logo from "assets/bb-emblem.svg"
import { TestimonialPage } from "@budibase/frontend-core/src/components"
import { TestimonialPage, PasswordRepeatInput } from "@budibase/frontend-core"
import { onMount } from "svelte"
import PasswordRepeatInput from "@budibase/frontend-core/src/components/PasswordRepeatInput.svelte"
const resetCode = $params["?code"]
let form
@ -79,7 +78,11 @@
<Layout gap="S" noPadding>
<Heading size="M">Reset your password</Heading>
<Body size="M">Must contain at least 12 characters</Body>
<PasswordRepeatInput bind:password bind:error={passwordError} />
<PasswordRepeatInput
bind:password
bind:error={passwordError}
minLength={$admin.passwordMinLength || 12}
/>
<Button secondary cta on:click={reset}>
{#if loading}
<ProgressCircle overBackground={true} size="S" />

View File

@ -7,6 +7,7 @@
import ThemeModal from "@/components/settings/ThemeModal.svelte"
import APIKeyModal from "@/components/settings/APIKeyModal.svelte"
import { UserAvatar } from "@budibase/frontend-core"
import { API } from "@/api"
let themeModal
let profileModal
@ -60,10 +61,14 @@
<ThemeModal />
</Modal>
<Modal bind:this={profileModal}>
<ProfileModal />
<ProfileModal {API} user={$auth.user} on:save={() => auth.getSelf()} />
</Modal>
<Modal bind:this={updatePasswordModal}>
<ChangePasswordModal />
<ChangePasswordModal
{API}
passwordMinLength={$admin.passwordMinLength}
on:save={() => auth.getSelf()}
/>
</Modal>
<Modal bind:this={apiKeyModal}>
<APIKeyModal />

View File

@ -5,6 +5,7 @@
import { createEventDispatcher } from "svelte"
export let API: APIClient
export let passwordMinLength: string | undefined = undefined
const dispatch = createEventDispatcher()
@ -36,5 +37,5 @@
disabled={!!error || !password}
>
<Body size="S">Enter your new password below.</Body>
<PasswordRepeatInput bind:password bind:error />
<PasswordRepeatInput bind:password bind:error minLength={passwordMinLength} />
</ModalContent>

View File

@ -4,7 +4,7 @@
export let password
export let error
export let minLength = 12
export let minLength = "12"
const validatePassword = value => {
if (!value || value.length < minLength) {

View File

@ -8,8 +8,6 @@
export let user: User | ContextUser | undefined = undefined
export let API: APIClient
$: console.log(user)
const dispatch = createEventDispatcher()
const values = writable({

View File

@ -11,3 +11,4 @@ export { default as CoreFilterBuilder } from "./CoreFilterBuilder.svelte"
export { default as FilterUsers } from "./FilterUsers.svelte"
export { default as ChangePasswordModal } from "./ChangePasswordModal.svelte"
export { default as ProfileModal } from "./ProfileModal.svelte"
export { default as PasswordRepeatInput } from "./PasswordRepeatInput.svelte"