Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat(dify-ui): add PasswordField and use it for every password input (#45249)
yyhcd42e62cd8a1
diff --git a/packages/dify-ui/README.md b/packages/dify-ui/README.mdindex 5d2ee873ead..c2b8fb86aeb 100644--- a/packages/dify-ui/README.md+++ b/packages/dify-ui/README.md@@ -34,18 +34,18 @@ Import `styles.css` once from the consumer's root stylesheet or entrypoint.## Primitives-| Category | Public subpaths |-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| Actions | `./button`, `./icon-button`, `./toggle` |-| Controls | `./segmented-control` |-| Display | `./collapsible`, `./kbd` |-| Feedback | `./alert`, `./meter`, `./progress`, `./spinner`, `./status-dot`, `./toast` |-| Form | `./form`, `./field`, `./fieldset`, `./input`, `./input-group`, `./textarea`, `./checkbox`, `./checkbox-group`, `./radio-group`, `./number-field`, `./select`, `./slider`, `./switch` |-| Layout | `./scroll-area`, `./separator` |-| Media | `./avatar` |-| Navigation | `./breadcrumb`, `./file-tree`, `./pagination`, `./tabs` |-| Overlay and menu | `./alert-dialog`, `./context-menu`, `./dialog`, `./drawer`, `./menu`, `./infotip`, `./popover`, `./preview-card`, `./tooltip` |-| Search and pick | `./autocomplete`, `./combobox`, `./select`, `./date-picker`, `./time-picker`, `./date-time-picker` |+| Category | Public subpaths |+| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Actions | `./button`, `./icon-button`, `./toggle` |+| Controls | `./segmented-control` |+| Display | `./collapsible`, `./kbd` |+| Feedback | `./alert`, `./meter`, `./progress`, `./spinner`, `./status-dot`, `./toast` |+| Form | `./form`, `./field`, `./fieldset`, `./input`, `./input-group`, `./password-field`, `./textarea`, `./checkbox`, `./checkbox-group`, `./radio-group`, `./number-field`, `./select`, `./slider`, `./switch` |+| Layout | `./scroll-area`, `./separator` |+| Media | `./avatar` |+| Navigation | `./breadcrumb`, `./file-tree`, `./pagination`, `./tabs` |+| Overlay and menu | `./alert-dialog`, `./context-menu`, `./dialog`, `./drawer`, `./menu`, `./infotip`, `./popover`, `./preview-card`, `./tooltip` |+| Search and pick | `./autocomplete`, `./combobox`, `./select`, `./date-picker`, `./time-picker`, `./date-time-picker` |Utilities:@@ -72,6 +72,7 @@ Upstream behavior remains owned by the [Base UI documentation].| [Icon Button] | Accessible names, decorative glyphs, appearance ownership, and primitive composition. || [Infotip] | Explanation triggers, concise dialog names, and hint surface ownership. || [Input Group] | Compound input anatomy, shared-surface ownership, DOM order, focus, and interactive addons. |+| [Password Field] | Password and secret inputs, required autocomplete, and the optional reveal toggle. |### Cross-component guides@@ -100,6 +101,7 @@ For a known contract, go directly to its guide above.[Infotip]: ./src/infotip/README.md[Input Group]: ./src/input-group/README.md[Overlays]: ./docs/overlays.md+[Password Field]: ./src/password-field/README.md[Public API authoring]: ./docs/authoring.md[Selection]: ./docs/selection.md[Styling]: ./docs/styling.mddiff --git a/packages/dify-ui/package.json b/packages/dify-ui/package.jsonindex b0413c240fd..7f4b244b2eb 100644--- a/packages/dify-ui/package.json+++ b/packages/dify-ui/package.json@@ -145,6 +145,10 @@"types": "./src/radio-group/index.tsx","import": "./src/radio-group/index.tsx"},+ "./password-field": {+ "types": "./src/password-field/index.tsx",+ "import": "./src/password-field/index.tsx"+ },"./popover": {"types": "./src/popover/index.tsx","import": "./src/popover/index.tsx"diff --git a/packages/dify-ui/src/input-group/index.stories.tsx b/packages/dify-ui/src/input-group/index.stories.tsxindex ddafe1a2b2d..100b79564cf 100644--- a/packages/dify-ui/src/input-group/index.stories.tsx+++ b/packages/dify-ui/src/input-group/index.stories.tsx@@ -27,8 +27,6 @@ export default metatype Story = StoryObj<typeof meta>function InputGroupsDemo() {- const [passwordVisible, setPasswordVisible] = React.useState(false)-return (<div className="grid w-80 gap-4"><Field name="repositoryUrl">@@ -45,29 +43,6 @@ function InputGroupsDemo() {https:// is displayed as a fixed prefix and is not part of the input value.</FieldDescription></Field>-- <Field name="password">- <FieldLabel>Password</FieldLabel>- <InputGroup>- <InputGroupInput- type={passwordVisible ? 'text' : 'password'}- placeholder="Enter your password"- autoComplete="current-password"- />- <InputGroupAddon align="inline-end">- <IconButton- size="md"- aria-label={passwordVisible ? 'Hide password' : 'Show password'}- onClick={() => setPasswordVisible((visible) => !visible)}- >- <span- className={passwordVisible ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'}- aria-hidden="true"- />- </IconButton>- </InputGroupAddon>- </InputGroup>- </Field></div>)}@@ -162,13 +137,6 @@ function InputGroupDropdownDemo() {export const Basic: Story = {render: () => <InputGroupsDemo />,- play: async ({ canvas, userEvent }) => {- const passwordInput = canvas.getByLabelText('Password')-- await expect(passwordInput).toHaveAttribute('type', 'password')- await userEvent.click(canvas.getByRole('button', { name: 'Show password' }))- await expect(passwordInput).toHaveAttribute('type', 'text')- },}export const WithAction: Story = {diff --git a/packages/dify-ui/src/password-field/README.md b/packages/dify-ui/src/password-field/README.mdnew file mode 100644index 00000000000..0293d3f12a2--- /dev/null+++ b/packages/dify-ui/src/password-field/README.md@@ -0,0 +1,37 @@+# Password Field++Use `PasswordField` for a password the user types and may reveal to check. It renders+the [Input Group] surface, so the shared border, background, focus, invalid, and disabled visuals+are the same as every other grouped input.++## Anatomy++```tsx+<Field name="password">+ <FieldLabel>Password</FieldLabel>+ <PasswordField>+ <PasswordFieldInput autoComplete="current-password" required />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+</Field>+```++The anatomy mirrors the [Base UI Password Field] preview. Dify UI owns the appearance and this+public API: the surface, the input styles, the toggle's size and glyph. The reveal behavior is a+minimal local implementation until Base UI ships the primitive; the parts then become styled+wrappers around it without changing call sites.++## Contract++- `PasswordFieldInput` owns `type`. `autoComplete` is required: `current-password` for an+ existing password, `new-password` for a password being set.+- `PasswordFieldToggle` is optional. Its `aria-label` stays constant; `aria-pressed` reports+ whether the value is revealed. Pressing it with a pointer keeps focus in the input. It stays+ available while the input is read-only.+- `disabled` on `PasswordField` applies to the input and the toggle; a disabled `Field` reaches+ only the input. Wrap the field in `Field` for the label, validation, and errors.+- Other masked values, such as tokens, use `Input` with `type="password"` and `autoComplete="off"`.+ `new-password` would make browsers suggest a generated password for them.++[Base UI Password Field]: https://github.com/mui/base-ui/pull/5114+[Input Group]: ../input-group/README.mddiff --git a/packages/dify-ui/src/password-field/__tests__/index.spec.tsx b/packages/dify-ui/src/password-field/__tests__/index.spec.tsxnew file mode 100644index 00000000000..4fcbfaedd1f--- /dev/null+++ b/packages/dify-ui/src/password-field/__tests__/index.spec.tsx@@ -0,0 +1,98 @@+import { userEvent } from 'vite-plus/test/browser'+import { render } from 'vitest-browser-react'+import { Field, FieldLabel } from '../../field'+import { PasswordField, PasswordFieldInput, PasswordFieldToggle } from '../index'++describe('PasswordField', () => {+ it('should reveal and mask the value through a toggle with a constant name', async () => {+ const screen = await render(+ <Field name="password">+ <FieldLabel>Password</FieldLabel>+ <PasswordField>+ <PasswordFieldInput autoComplete="current-password" defaultValue="secret" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ </Field>,+ )+ const input = screen.getByLabelText('Password')+ const toggle = screen.getByRole('button', { name: 'Show password' })++ await expect.element(input).toHaveAttribute('type', 'password')+ await expect.element(input).toHaveAttribute('autocomplete', 'current-password')+ await expect.element(input).toHaveAttribute('spellcheck', 'false')+ await expect.element(toggle).toHaveAttribute('aria-pressed', 'false')++ await toggle.click()++ await expect.element(input).toHaveAttribute('type', 'text')+ await expect.element(toggle).toHaveAttribute('aria-pressed', 'true')++ await toggle.click()++ await expect.element(input).toHaveAttribute('type', 'password')+ await expect.element(toggle).toHaveAttribute('aria-pressed', 'false')+ })++ it('should keep focus in the input when the toggle is pressed with a pointer', async () => {+ const screen = await render(+ <PasswordField>+ <PasswordFieldInput aria-label="Password" autoComplete="current-password" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>,+ )+ const input = screen.getByLabelText('Password')++ await input.click()+ await screen.getByRole('button', { name: 'Show password' }).click()++ await expect.element(input).toHaveFocus()+ })++ it('should reach the toggle after the input with the keyboard', async () => {+ const screen = await render(+ <PasswordField>+ <PasswordFieldInput aria-label="Password" autoComplete="new-password" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>,+ )+ const toggle = screen.getByRole('button', { name: 'Show password' })++ await userEvent.keyboard('{Tab}')+ await expect.element(screen.getByLabelText('Password')).toHaveFocus()+ await userEvent.keyboard('{Tab}')+ await expect.element(toggle).toHaveFocus()+ await userEvent.keyboard('{Enter}')++ await expect.element(toggle).toHaveAttribute('aria-pressed', 'true')+ })++ it('should disable the input and the toggle from the root', async () => {+ const screen = await render(+ <PasswordField disabled>+ <PasswordFieldInput aria-label="Password" autoComplete="current-password" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>,+ )++ await expect.element(screen.getByLabelText('Password')).toBeDisabled()+ await expect.element(screen.getByRole('button', { name: 'Show password' })).toBeDisabled()+ })++ it('should let a read-only value be revealed', async () => {+ const screen = await render(+ <PasswordField>+ <PasswordFieldInput+ aria-label="Password"+ autoComplete="current-password"+ defaultValue="secret"+ readOnly+ />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>,+ )++ await screen.getByRole('button', { name: 'Show password' }).click()++ await expect.element(screen.getByLabelText('Password')).toHaveAttribute('type', 'text')+ })+})diff --git a/packages/dify-ui/src/password-field/__tests__/types.tsx b/packages/dify-ui/src/password-field/__tests__/types.tsxnew file mode 100644index 00000000000..558829439a4--- /dev/null+++ b/packages/dify-ui/src/password-field/__tests__/types.tsx@@ -0,0 +1,24 @@+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'++export function passwordFieldTypeContracts() {+ const composition = (+ <PasswordField>+ <PasswordFieldInput autoComplete="new-password" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ )+ // @ts-expect-error The caller states whether the value is a current or a new credential.+ const withoutAutoComplete = <PasswordFieldInput />+ // @ts-expect-error The input type follows the toggle.+ const withType = <PasswordFieldInput autoComplete="new-password" type="text" />+ // @ts-expect-error The toggle is icon-only and needs an accessible name.+ const unnamedToggle = <PasswordFieldToggle />+ // @ts-expect-error The toggle owns its glyph.+ const toggleWithChildren = <PasswordFieldToggle aria-label="Show">Show</PasswordFieldToggle>++ return [composition, withoutAutoComplete, withType, unnamedToggle, toggleWithChildren]+}diff --git a/packages/dify-ui/src/password-field/index.stories.tsx b/packages/dify-ui/src/password-field/index.stories.tsxnew file mode 100644index 00000000000..f41854774bf--- /dev/null+++ b/packages/dify-ui/src/password-field/index.stories.tsx@@ -0,0 +1,145 @@+import type { Meta, StoryObj } from '@storybook/react-vite'+import { expect } from 'storybook/test'+import { Button } from '../button'+import { Field, FieldDescription, FieldError, FieldLabel } from '../field'+import { Form } from '../form'+import { PasswordField, PasswordFieldInput, PasswordFieldToggle } from './index'++const meta = {+ title: 'Base/Form/PasswordField',+ component: PasswordField,+ parameters: {+ layout: 'centered',+ docs: {+ description: {+ component:+ 'A password input on the InputGroup surface. PasswordFieldInput requires autoComplete; PasswordFieldToggle reveals the value.',+ },+ },+ },+ tags: ['autodocs'],+} satisfies Meta<typeof PasswordField>++export default meta++type Story = StoryObj<typeof meta>++export const Basic: Story = {+ render: () => (+ <Field name="password" className="w-80">+ <FieldLabel>Password</FieldLabel>+ <PasswordField>+ <PasswordFieldInput autoComplete="current-password" placeholder="Enter your password" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ </Field>+ ),+ play: async ({ canvas, userEvent }) => {+ const input = canvas.getByLabelText('Password')+ const toggle = canvas.getByRole('button', { name: 'Show password' })++ await userEvent.click(input)+ await userEvent.keyboard('secret')+ await expect(input).toHaveAttribute('type', 'password')+ await expect(toggle).toHaveAttribute('aria-pressed', 'false')++ await userEvent.click(toggle)+ await expect(input).toHaveAttribute('type', 'text')+ await expect(toggle).toHaveAttribute('aria-pressed', 'true')+ await expect(input).toHaveFocus()++ await userEvent.click(toggle)+ await expect(input).toHaveAttribute('type', 'password')+ },+}++export const States: Story = {+ render: () => (+ <div className="grid w-80 gap-3">+ <Field name="placeholderPassword">+ <FieldLabel>Placeholder</FieldLabel>+ <PasswordField>+ <PasswordFieldInput autoComplete="current-password" placeholder="Enter your password" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ </Field>+ <Field name="filledPassword">+ <FieldLabel>Filled</FieldLabel>+ <PasswordField>+ <PasswordFieldInput autoComplete="current-password" defaultValue="correct-horse" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ </Field>+ <Field name="invalidPassword" invalid>+ <FieldLabel>Invalid</FieldLabel>+ <PasswordField>+ <PasswordFieldInput autoComplete="new-password" defaultValue="short" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ <FieldError match>Use at least 8 characters with letters and numbers.</FieldError>+ </Field>+ <Field name="readonlyPassword">+ <FieldLabel>Read-only</FieldLabel>+ <PasswordField>+ <PasswordFieldInput+ autoComplete="current-password"+ readOnly+ defaultValue="correct-horse"+ />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ </Field>+ <Field name="disabledPassword">+ <FieldLabel>Disabled</FieldLabel>+ <PasswordField disabled>+ <PasswordFieldInput autoComplete="current-password" defaultValue="correct-horse" />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ </Field>+ </div>+ ),+ play: async ({ canvas }) => {+ await expect(canvas.getByLabelText('Disabled')).toBeDisabled()+ const toggles = canvas.getAllByRole('button', { name: 'Show password' })+ await expect(toggles.at(-1)).toBeDisabled()+ },+}++export const WithField: Story = {+ render: () => (+ <Form aria-label="Set password" className="grid w-80 gap-4" onFormSubmit={() => undefined}>+ <Field name="newPassword">+ <FieldLabel>New password</FieldLabel>+ <PasswordField>+ <PasswordFieldInput+ autoComplete="new-password"+ required+ minLength={8}+ placeholder="Enter a new password"+ />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ <FieldDescription>At least 8 characters with letters and numbers.</FieldDescription>+ <FieldError match="valueMissing">Password is required.</FieldError>+ <FieldError match="tooShort">Use at least 8 characters.</FieldError>+ </Field>+ <Field name="confirmPassword">+ <FieldLabel>Confirm password</FieldLabel>+ <PasswordField>+ <PasswordFieldInput+ autoComplete="new-password"+ required+ placeholder="Enter the password again"+ />+ <PasswordFieldToggle aria-label="Show password" />+ </PasswordField>+ <FieldError match="valueMissing">Confirm your password.</FieldError>+ </Field>+ <div className="flex justify-end">+ <Button type="submit" variant="primary">+ Set Password+ </Button>+ </div>+ </Form>+ ),+}diff --git a/packages/dify-ui/src/password-field/index.tsx b/packages/dify-ui/src/password-field/index.tsxnew file mode 100644index 00000000000..a027f7610d5--- /dev/null+++ b/packages/dify-ui/src/password-field/index.tsx@@ -0,0 +1,95 @@+'use client'++import type { InputGroupProps } from '../input-group'+import { Input as BaseInput } from '@base-ui/react/input'+import * as React from 'react'+import { cn } from '../cn'+import { IconButton } from '../icon-button'+import { InputGroup, InputGroupAddon } from '../input-group'+import { textControlGroupInputClassName } from '../internal/form-control'+import { resolveClassName } from '../internal/resolve-class-name'++type PasswordFieldContextValue = {+ visible: boolean+ setVisible: React.Dispatch<React.SetStateAction<boolean>>+ disabled: boolean+}++const PasswordFieldContext = React.createContext<PasswordFieldContextValue | null>(null)++function usePasswordFieldContext() {+ const context = React.useContext(PasswordFieldContext)+ if (!context) throw new Error('PasswordField parts must be placed within <PasswordField>.')+ return context+}++type PasswordFieldProps = InputGroupProps & {+ disabled?: boolean+}++function PasswordField({ disabled = false, ...props }: PasswordFieldProps) {+ const [visible, setVisible] = React.useState(false)+ const contextValue = React.useMemo(() => ({ visible, setVisible, disabled }), [visible, disabled])++ return (+ <PasswordFieldContext.Provider value={contextValue}>+ <InputGroup {...props} />+ </PasswordFieldContext.Provider>+ )+}++type PasswordFieldInputProps = Omit<+ BaseInput.Props,+ 'autoComplete' | 'render' | 'size' | 'type'+> & {+ autoComplete: 'current-password' | 'new-password'+}++function PasswordFieldInput({ className, disabled, ...props }: PasswordFieldInputProps) {+ const { visible, disabled: rootDisabled } = usePasswordFieldContext()++ return (+ <BaseInput+ spellCheck={false}+ autoCapitalize="off"+ autoCorrect="off"+ {...props}+ type={visible ? 'text' : 'password'}+ disabled={rootDisabled || disabled}+ className={(state) =>+ cn(textControlGroupInputClassName, 'px-3', resolveClassName(className, state))+ }+ />+ )+}++type PasswordFieldToggleProps = {+ 'aria-label': string+ disabled?: boolean+}++function PasswordFieldToggle({ disabled, ...props }: PasswordFieldToggleProps) {+ const { visible, setVisible, disabled: rootDisabled } = usePasswordFieldContext()++ return (+ <InputGroupAddon align="inline-end">+ <IconButton+ {...props}+ aria-pressed={visible}+ disabled={rootDisabled || disabled}+ onMouseDown={(event) => {+ if (event.button === 0) event.preventDefault()+ }}+ onClick={() => setVisible((current) => !current)}+ >+ <span+ aria-hidden="true"+ className={visible ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'}+ />+ </IconButton>+ </InputGroupAddon>+ )+}++export { PasswordField, PasswordFieldInput, PasswordFieldToggle }+export type { PasswordFieldInputProps, PasswordFieldProps, PasswordFieldToggleProps }diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsxindex 4f83db7e096..95cd1f3b038 100644--- a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx+++ b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx@@ -3,8 +3,11 @@ import { Button, buttonVariants } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { IconButton } from '@langgenius/dify-ui/icon-button'-import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { RiCheckboxCircleFill } from '@remixicon/react'import { useCountDown } from 'ahooks'import { useCallback, useState } from 'react'@@ -25,8 +28,6 @@ const ChangePasswordForm = () => {const [password, setPassword] = useState('')const [confirmPassword, setConfirmPassword] = useState('')const [showSuccess, setShowSuccess] = useState(false)- const [showPassword, setShowPassword] = useState(false)- const [showConfirmPassword, setShowConfirmPassword] = useState(false)useDocumentTitle(showSuccess? t(($) => $.passwordChangedTip, { ns: 'login' })@@ -106,31 +107,15 @@ const ChangePasswordForm = () => {<FieldLabel className="system-md-semibold">{t(($) => $['account.newPassword'], { ns: 'accountSettings' })}</FieldLabel>- <InputGroup>- <InputGroupInput- type={showPassword ? 'text' : 'password'}+ <PasswordField>+ <PasswordFieldInputautoComplete="new-password"- spellCheck={false}value={password}onValueChange={setPassword}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {- ns: 'login',- })}- onClick={() => setShowPassword(!showPassword)}- >- <span- className={- showPassword ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'- }- aria-hidden="true"- />- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField></div><FieldDescription className="py-0 body-xs-regular text-text-secondary">{t(($) => $['error.passwordInvalid'], { ns: 'login' })}@@ -140,32 +125,15 @@ const ChangePasswordForm = () => {<FieldLabel className="system-md-semibold">{t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}</FieldLabel>- <InputGroup>- <InputGroupInput- type={showConfirmPassword ? 'text' : 'password'}+ <PasswordField>+ <PasswordFieldInputautoComplete="new-password"- spellCheck={false}value={confirmPassword}onValueChange={setConfirmPassword}placeholder={t(($) => $.confirmPasswordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- aria-label={t(- ($) => $[showConfirmPassword ? 'hidePassword' : 'showPassword'],- { ns: 'login' },- )}- onClick={() => setShowConfirmPassword(!showConfirmPassword)}- >- <span- className={- showConfirmPassword ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'- }- aria-hidden="true"- />- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField></Field><Button type="submit" variant="primary" className="w-full">{t(($) => $.changePasswordBtn, { ns: 'login' })}diff --git a/web/app/(shareLayout)/webapp-signin/components/__tests__/mail-and-password-auth.spec.tsx b/web/app/(shareLayout)/webapp-signin/components/__tests__/mail-and-password-auth.spec.tsxindex d2426e175d3..aabfc4bd55f 100644--- a/web/app/(shareLayout)/webapp-signin/components/__tests__/mail-and-password-auth.spec.tsx+++ b/web/app/(shareLayout)/webapp-signin/components/__tests__/mail-and-password-auth.spec.tsx@@ -157,17 +157,20 @@ describe('MailAndPasswordAuth', () => {await waitFor(() => expect(submit).not.toHaveAttribute('aria-disabled', 'true'))})- it('names the password visibility action for its current state', async () => {+ it('toggles password visibility with a constant action name', async () => {const user = userEvent.setup()render(<MailAndPasswordAuth isEmailSetup />)const passwordInput = screen.getByLabelText('login.password')expect(passwordInput).toHaveAttribute('type', 'password')- await user.click(screen.getByRole('button', { name: 'login.showPassword' }))+ const toggle = screen.getByRole('button', { name: 'login.showPassword' })+ await user.click(toggle)expect(passwordInput).toHaveAttribute('type', 'text')+ expect(toggle).toHaveAttribute('aria-pressed', 'true')- await user.click(screen.getByRole('button', { name: 'login.hidePassword' }))+ await user.click(toggle)expect(passwordInput).toHaveAttribute('type', 'password')+ expect(toggle).toHaveAttribute('aria-pressed', 'false')})})diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsxindex 78783c3a930..7550e2a04f1 100644--- a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx+++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx@@ -2,9 +2,12 @@import { Button } from '@langgenius/dify-ui/button'import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { IconButton } from '@langgenius/dify-ui/icon-button'import { Input } from '@langgenius/dify-ui/input'-import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { useEffect, useState } from 'react'import { useTranslation } from 'react-i18next'import {@@ -32,7 +35,6 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAutconst { t } = useTranslation(['login'])const router = useRouter()const searchParams = useSearchParams()- const [showPassword, setShowPassword] = useState(false)const emailFromLink = decodeURIComponent(searchParams.get('email') || '')const [isLoading, setIsLoading] = useState(false)const redirectUrl = searchParams.get('redirect_url')@@ -143,28 +145,14 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut{t(($) => $.forget, { ns: 'login' })}</Link></div>- <InputGroup className="mt-1">- <InputGroupInput+ <PasswordField className="mt-1">+ <PasswordFieldInputid="password"- type={showPassword ? 'text' : 'password'}autoComplete="current-password"- spellCheck={false}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- type="button"- size="lg"- variant="ghost"- aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {- ns: 'login',- })}- onClick={() => setShowPassword(!showPassword)}- >- <span aria-hidden="true">{showPassword ? '👀' : '😝'}</span>- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldError /></Field>diff --git a/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx b/web/app/account/(commonLayout)/account-page/change-password-dialog.tsxindex 2d7e27ed0da..7de73bf67d5 100644--- a/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx+++ b/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx@@ -15,8 +15,11 @@ import {} from '@langgenius/dify-ui/dialog'import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { IconButton } from '@langgenius/dify-ui/icon-button'-import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { ORPCError } from '@orpc/client'import { useMutation, useQueryClient } from '@tanstack/react-query'import { useRef, useState } from 'react'@@ -32,37 +35,23 @@ type ChangePasswordFormValues = {'confirm-password': string}-type PasswordFieldProps = {+type ChangePasswordFieldProps = {name: keyof ChangePasswordFormValueslabel: stringautoComplete: 'current-password' | 'new-password'readOnly: boolean}-function PasswordField({ name, label, autoComplete, readOnly }: PasswordFieldProps) {+function ChangePasswordField({ name, label, autoComplete, readOnly }: ChangePasswordFieldProps) {const { t } = useTranslation(['login'])- const [visible, setVisible] = useState(false)return (<Field name={name}><FieldLabel className="system-sm-semibold">{label}</FieldLabel>- <InputGroup>- <InputGroupInput- type={visible ? 'text' : 'password'}- autoComplete={autoComplete}- spellCheck={false}- readOnly={readOnly}- />- <InputGroupAddon align="inline-end">- <IconButton- size="lg"- aria-label={t(($) => $[visible ? 'hidePassword' : 'showPassword'], { ns: 'login' })}- onClick={() => setVisible(!visible)}- >- <span aria-hidden="true">{visible ? '👀' : '😝'}</span>- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordField>+ <PasswordFieldInput autoComplete={autoComplete} readOnly={readOnly} />+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField></Field>)}@@ -117,14 +106,14 @@ function ChangePasswordForm({</DialogHeader><DialogBody className="space-y-8">{isPasswordSet && (- <PasswordField+ <ChangePasswordFieldname="current-password"label={t(($) => $['account.currentPassword'], { ns: 'accountSettings' })}autoComplete="current-password"readOnly={isPending}/>)}- <PasswordField+ <ChangePasswordFieldname="new-password"label={isPasswordSet@@ -134,7 +123,7 @@ function ChangePasswordForm({autoComplete="new-password"readOnly={isPending}/>- <PasswordField+ <ChangePasswordFieldname="confirm-password"label={t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}autoComplete="new-password"diff --git a/web/app/components/base/form/components/base/base-field.tsx b/web/app/components/base/form/components/base/base-field.tsxindex ca9ddde713b..123cb2aef97 100644--- a/web/app/components/base/form/components/base/base-field.tsx+++ b/web/app/components/base/form/components/base/base-field.tsx@@ -30,7 +30,7 @@ import { useTriggerPluginDynamicOptions } from '@/service/use-triggers'const getExtraProps = (type: FormTypeEnum) => {switch (type) {case FormTypeEnum.secretInput:- return { type: 'password', autoComplete: 'new-password' }+ return { type: 'password', autoComplete: 'off' }default:return { type: 'text' }}diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsxindex 2894613bf51..576482406a8 100644--- a/web/app/forgot-password/ChangePasswordForm.tsx+++ b/web/app/forgot-password/ChangePasswordForm.tsx@@ -10,7 +10,11 @@ import {FieldValidity,} from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { Input } from '@langgenius/dify-ui/input'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { useCallback, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'@@ -132,17 +136,18 @@ const ChangePasswordForm = () => {<FieldLabel>{t(($) => $['account.newPassword'], { ns: 'accountSettings' })}</FieldLabel>- <Input- type="password"- required- autoComplete="new-password"- spellCheck={false}- onValueChange={() => {- if (confirmPasswordRef.current?.value)- formActionsRef.current?.validate('confirmPassword')- }}- placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}- />+ <PasswordField>+ <PasswordFieldInput+ required+ autoComplete="new-password"+ onValueChange={() => {+ if (confirmPasswordRef.current?.value)+ formActionsRef.current?.validate('confirmPassword')+ }}+ placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}+ />+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldValidity>{({ validity }) =>validity.valid !== false ? (@@ -179,14 +184,15 @@ const ChangePasswordForm = () => {<FieldLabel>{t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}</FieldLabel>- <Input- type="password"- required- autoComplete="new-password"- spellCheck={false}- ref={confirmPasswordRef}- placeholder={t(($) => $.confirmPasswordPlaceholder, { ns: 'login' }) || ''}- />+ <PasswordField>+ <PasswordFieldInput+ required+ autoComplete="new-password"+ ref={confirmPasswordRef}+ placeholder={t(($) => $.confirmPasswordPlaceholder, { ns: 'login' }) || ''}+ />+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldError>{t(($) => $['account.notEqual'], { ns: 'accountSettings' })}</FieldError>diff --git a/web/app/init/InitPasswordPopup.tsx b/web/app/init/InitPasswordPopup.tsxindex 016b8fc0088..f93e9aba0ab 100644--- a/web/app/init/InitPasswordPopup.tsx+++ b/web/app/init/InitPasswordPopup.tsx@@ -1,5 +1,6 @@'use client'import { Button } from '@langgenius/dify-ui/button'+import { Input } from '@langgenius/dify-ui/input'import { useEffect, useState } from 'react'import { useTranslation } from 'react-i18next'import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'@@ -55,15 +56,14 @@ const InitPasswordPopup = () => {<label htmlFor="password" className="block text-sm font-medium text-text-secondary">{pageTitle}</label>- <div className="relative mt-1 rounded-md shadow-sm">- <input- id="password"- type="password"- value={password}- onChange={(e) => setPassword(e.target.value)}- className="block w-full appearance-none rounded-md border border-divider-regular px-3 py-2 shadow-sm placeholder:text-text-quaternary focus:border-indigo-500 focus:ring-indigo-500 focus:outline-hidden sm:text-sm"- />- </div>+ <Input+ id="password"+ type="password"+ autoComplete="off"+ className="mt-1"+ value={password}+ onValueChange={setPassword}+ /></div><div className="flex flex-row flex-wrap justify-stretch p-0"><Button variant="primary" onClick={handleValidation} className="min-w-28 basis-full">diff --git a/web/app/install/installForm.spec.tsx b/web/app/install/installForm.spec.tsxindex 87295135507..7c4089a17aa 100644--- a/web/app/install/installForm.spec.tsx+++ b/web/app/install/installForm.spec.tsx@@ -172,7 +172,7 @@ describe('InstallForm', () => {await user.click(screen.getByRole('button', { name: 'login.showPassword' }))expect(passwordInput).toHaveAttribute('type', 'text')- await user.click(screen.getByRole('button', { name: 'login.hidePassword' }))+ await user.click(screen.getByRole('button', { name: 'login.showPassword' }))expect(passwordInput).toHaveAttribute('type', 'password')})diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsxindex 05fc0ca7b6d..f355a45e17a 100644--- a/web/app/install/installForm.tsx+++ b/web/app/install/installForm.tsx@@ -9,9 +9,12 @@ import {FieldValidity,} from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { IconButton } from '@langgenius/dify-ui/icon-button'import { Input } from '@langgenius/dify-ui/input'-import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { useQuery, useQueryClient } from '@tanstack/react-query'import * as React from 'react'import { useEffect } from 'react'@@ -40,7 +43,6 @@ const InstallForm = () => {useDocumentTitle(pageTitle)const { push, replace } = useRouter()const queryClient = useQueryClient()- const [showPassword, setShowPassword] = React.useState(false)const [isSubmitting, setIsSubmitting] = React.useState(false)const setupStatus = useQuery(consoleQuery.setup.get.queryOptions({@@ -188,29 +190,15 @@ const InstallForm = () => {className="mb-5"><FieldLabel>{t(($) => $.password, { ns: 'login' })}</FieldLabel>- <InputGroup>- <InputGroupInput- type={showPassword ? 'text' : 'password'}+ <PasswordField>+ <PasswordFieldInputautoComplete="new-password"- spellCheck={false}requiredminLength={8}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {- ns: 'login',- })}- onClick={() => setShowPassword((visible) => !visible)}- >- <span- aria-hidden="true"- className={showPassword ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'}- />- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldValidity>{({ validity }) =>validity.valid === false ? null : (diff --git a/web/app/reset-password/set-password/__tests__/page.spec.tsx b/web/app/reset-password/set-password/__tests__/page.spec.tsxindex d6d8bd258bb..7b376064852 100644--- a/web/app/reset-password/set-password/__tests__/page.spec.tsx+++ b/web/app/reset-password/set-password/__tests__/page.spec.tsx@@ -91,10 +91,11 @@ describe('Reset Password Set Password Page', () => {expect(confirmPasswordInput).toHaveAttribute('autocomplete', 'new-password')await user.type(passwordInput, 'ValidPass123!')- await user.click(screen.getAllByRole('button', { name: 'login.showPassword' })[0]!)+ const [showPasswordButton] = screen.getAllByRole('button', { name: 'login.showPassword' })+ await user.click(showPasswordButton!)expect(passwordInput).toHaveAttribute('type', 'text')- expect(screen.getByRole('button', { name: 'login.hidePassword' })).toBeInTheDocument()+ expect(showPasswordButton).toHaveAttribute('aria-pressed', 'true')await user.type(confirmPasswordInput, 'ValidPass123!{Enter}')diff --git a/web/app/reset-password/set-password/page.tsx b/web/app/reset-password/set-password/page.tsxindex cf9833de5e8..5da3554dfbb 100644--- a/web/app/reset-password/set-password/page.tsx+++ b/web/app/reset-password/set-password/page.tsx@@ -10,8 +10,11 @@ import {FieldValidity,} from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { IconButton } from '@langgenius/dify-ui/icon-button'-import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { useCountDown } from 'ahooks'import { useCallback, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'@@ -36,8 +39,6 @@ const ChangePasswordForm = () => {const confirmPasswordRef = useRef<HTMLInputElement>(null)const [isSubmitting, setIsSubmitting] = useState(false)const [showSuccess, setShowSuccess] = useState(false)- const [showPassword, setShowPassword] = useState(false)- const [showConfirmPassword, setShowConfirmPassword] = useState(false)useDocumentTitle(showSuccess? t(($) => $.passwordChangedTip, { ns: 'login' })@@ -128,34 +129,18 @@ const ChangePasswordForm = () => {<FieldLabel>{t(($) => $['account.newPassword'], { ns: 'accountSettings' })}</FieldLabel>- <InputGroup>- <InputGroupInput- type={showPassword ? 'text' : 'password'}+ <PasswordField>+ <PasswordFieldInputrequiredautoComplete="new-password"- spellCheck={false}onValueChange={() => {if (confirmPasswordRef.current?.value)formActionsRef.current?.validate('confirmPassword')}}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {- ns: 'login',- })}- onClick={() => setShowPassword(!showPassword)}- >- <span- className={- showPassword ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'- }- aria-hidden="true"- />- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldValidity>{({ validity }) =>validity.valid !== false ? (@@ -192,32 +177,15 @@ const ChangePasswordForm = () => {<FieldLabel>{t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}</FieldLabel>- <InputGroup>- <InputGroupInput- type={showConfirmPassword ? 'text' : 'password'}+ <PasswordField>+ <PasswordFieldInputrequiredautoComplete="new-password"- spellCheck={false}ref={confirmPasswordRef}placeholder={t(($) => $.confirmPasswordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- aria-label={t(- ($) => $[showConfirmPassword ? 'hidePassword' : 'showPassword'],- { ns: 'login' },- )}- onClick={() => setShowConfirmPassword(!showConfirmPassword)}- >- <span- className={- showConfirmPassword ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'- }- aria-hidden="true"- />- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldError>{t(($) => $['account.notEqual'], { ns: 'accountSettings' })}</FieldError>diff --git a/web/app/signin/__tests__/normal-form.spec.tsx b/web/app/signin/__tests__/normal-form.spec.tsxindex 14fd720ae66..e4caf16e264 100644--- a/web/app/signin/__tests__/normal-form.spec.tsx+++ b/web/app/signin/__tests__/normal-form.spec.tsx@@ -200,7 +200,7 @@ describe('NormalForm', () => {})})- it('should describe password visibility through its changing action name', async () => {+ it('should report password visibility through the toggle pressed state', async () => {const user = userEvent.setup()mockQueryResults(nonInviteQueryResult, nonInviteQueryResult)@@ -211,7 +211,7 @@ describe('NormalForm', () => {await user.click(showPasswordButton)- expect(screen.getByRole('button', { name: 'login.hidePassword' })).toBeInTheDocument()+ expect(showPasswordButton).toHaveAttribute('aria-pressed', 'true')expect(screen.getByLabelText('login.password')).toHaveAttribute('type', 'text')})diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsxindex 2aeee13575e..126328356ba 100644--- a/web/app/signin/components/mail-and-password-auth.tsx+++ b/web/app/signin/components/mail-and-password-auth.tsx@@ -2,9 +2,12 @@ import type { LoginPayload } from '@dify/contracts/api/console/login/types.gen'import { Button } from '@langgenius/dify-ui/button'import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { IconButton } from '@langgenius/dify-ui/icon-button'import { Input } from '@langgenius/dify-ui/input'-import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { useQueryClient } from '@tanstack/react-query'import { useState } from 'react'import { useTranslation } from 'react-i18next'@@ -33,7 +36,6 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndPconst router = useRouter()const queryClient = useQueryClient()const searchParams = useSearchParams()- const [showPassword, setShowPassword] = useState(false)const emailFromLink = decodeURIComponent(searchParams.get('email') || '')const [email, setEmail] = useState(emailFromLink)const [password, setPassword] = useState('')@@ -109,32 +111,16 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndP<Field name="password" className="relative mb-3"><FieldLabel>{t(($) => $.password, { ns: 'login' })}</FieldLabel>- <InputGroup>- <InputGroupInput+ <PasswordField>+ <PasswordFieldInputvalue={password}onValueChange={setPassword}- type={showPassword ? 'text' : 'password'}requiredautoComplete="current-password"- spellCheck={false}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}/>- <InputGroupAddon align="inline-end">- <IconButton- size="lg"- aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {- ns: 'login',- })}- onClick={() => setShowPassword(!showPassword)}- >- {showPassword ? (- <span className="i-ri-eye-off-line size-4" aria-hidden="true" />- ) : (- <span className="i-ri-eye-line size-4" aria-hidden="true" />- )}- </IconButton>- </InputGroupAddon>- </InputGroup>+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><Linkhref={`/reset-password?${searchParams.toString()}`}className={`absolute inset-e-0 top-1 rounded-sm system-xs-regular outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid ${isEmailSetup ? 'text-components-button-secondary-accent-text' : 'pointer-events-none text-components-button-secondary-accent-text-disabled'}`}diff --git a/web/app/signup/set-password/page.tsx b/web/app/signup/set-password/page.tsxindex 35c9fe66234..999ee60e923 100644--- a/web/app/signup/set-password/page.tsx+++ b/web/app/signup/set-password/page.tsx@@ -10,7 +10,11 @@ import {FieldValidity,} from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'-import { Input } from '@langgenius/dify-ui/input'+import {+ PasswordField,+ PasswordFieldInput,+ PasswordFieldToggle,+} from '@langgenius/dify-ui/password-field'import { useMutation, useQueryClient } from '@tanstack/react-query'import Cookies from 'js-cookie'import { useCallback, useRef } from 'react'@@ -133,17 +137,18 @@ const ChangePasswordForm = () => {<FieldLabel>{t(($) => $['account.newPassword'], { ns: 'accountSettings' })}</FieldLabel>- <Input- type="password"- required- autoComplete="new-password"- spellCheck={false}- onValueChange={() => {- if (confirmPasswordRef.current?.value)- formActionsRef.current?.validate('confirmPassword')- }}- placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}- />+ <PasswordField>+ <PasswordFieldInput+ required+ autoComplete="new-password"+ onValueChange={() => {+ if (confirmPasswordRef.current?.value)+ formActionsRef.current?.validate('confirmPassword')+ }}+ placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}+ />+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldValidity>{({ validity }) =>validity.valid !== false ? (@@ -178,14 +183,15 @@ const ChangePasswordForm = () => {<FieldLabel>{t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}</FieldLabel>- <Input- type="password"- required- autoComplete="new-password"- spellCheck={false}- ref={confirmPasswordRef}- placeholder={t(($) => $.confirmPasswordPlaceholder, { ns: 'login' }) || ''}- />+ <PasswordField>+ <PasswordFieldInput+ required+ autoComplete="new-password"+ ref={confirmPasswordRef}+ placeholder={t(($) => $.confirmPasswordPlaceholder, { ns: 'login' }) || ''}+ />+ <PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />+ </PasswordField><FieldError>{t(($) => $['account.notEqual'], { ns: 'accountSettings' })}</FieldError></Field><Button type="submit" variant="primary" className="w-full" loading={isPending}>diff --git a/web/features/contacts/im-platform/binding-dialog.tsx b/web/features/contacts/im-platform/binding-dialog.tsxindex a6b7d63f661..caccad13712 100644--- a/web/features/contacts/im-platform/binding-dialog.tsx+++ b/web/features/contacts/im-platform/binding-dialog.tsx@@ -363,7 +363,7 @@ export function ContactImBindingContent({</div><Inputref={index === 0 ? firstCredentialRef : undefined}- autoComplete={isSecret ? 'new-password' : 'off'}+ autoComplete="off"disabled={credentialsDisabled || clearedFields.includes(field)}placeholder={isSecret && canRetainField(field) && !clearedFields.includes(field)diff --git a/web/features/contacts/im-platform/email-config-dialog.tsx b/web/features/contacts/im-platform/email-config-dialog.tsxindex 062b243c532..137c590095b 100644--- a/web/features/contacts/im-platform/email-config-dialog.tsx+++ b/web/features/contacts/im-platform/email-config-dialog.tsx@@ -295,7 +295,7 @@ export function ContactEmailConfigContent({</div><Inputdisabled={credentialsDisabled}- autoComplete="new-password"+ autoComplete="off"placeholder={canRetainSecret ? '••••••••' : t(($) => $['imPlatform.email.apiKeyPlaceholder'])}diff --git a/web/i18n/locales/ar-TN/login.json b/web/i18n/locales/ar-TN/login.jsonindex 496eddd191d..4f738947ce4 100644--- a/web/i18n/locales/ar-TN/login.json+++ b/web/i18n/locales/ar-TN/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "يرجى إدخال عنوان بريدك الإلكتروني لإعادة تعيين كلمة المرور الخاصة بك. سنرسل لك بريدًا إلكترونيًا يحتوي على تعليمات حول كيفية إعادة تعيين كلمة المرور الخاصة بك.","go": "الذهاب إلى Dify","goToInit": "إذا لم تقم بتهيئة الحساب، يرجى الانتقال إلى صفحة التهيئة",- "hidePassword": "إخفاء كلمة المرور","installBtn": "إعداد","interfaceLanguage": "لغة الواجهة","invalid": "انتهت صلاحية الرابط",diff --git a/web/i18n/locales/az-AZ/login.json b/web/i18n/locales/az-AZ/login.jsonindex f7d6e833f60..194369a5416 100644--- a/web/i18n/locales/az-AZ/login.json+++ b/web/i18n/locales/az-AZ/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Parolunuzu sıfırlamaq üçün e-poçt ünvanınızı daxil edin. Sizə parolun sıfırlanması ilə bağlı təlimatlar olan e-poçt göndərəcəyik.","go": "Dify-a keç","goToInit": "Hesabın ilkin quraşdırmasını etməmisinizsə, ilkin quraşdırma səhifəsinə keçin",- "hidePassword": "Parolu gizlət","installBtn": "Quraşdır","interfaceLanguage": "İnterfeys dili","invalid": "Keçidin vaxtı bitib",diff --git a/web/i18n/locales/de-DE/login.json b/web/i18n/locales/de-DE/login.jsonindex c72c8dcb52c..3e874aa3992 100644--- a/web/i18n/locales/de-DE/login.json+++ b/web/i18n/locales/de-DE/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Bitte geben Sie Ihre E-Mail-Adresse ein, um Ihr Passwort zurückzusetzen. Wir senden Ihnen eine E-Mail mit Anweisungen zum Zurücksetzen Ihres Passworts.","go": "Zu Dify gehen","goToInit": "Wenn du das Konto noch nicht initialisiert hast, gehe bitte zur Initialisierungsseite",- "hidePassword": "Passwort ausblenden","installBtn": "Einrichten","interfaceLanguage": "Oberflächensprache","invalid": "Der Link ist abgelaufen",diff --git a/web/i18n/locales/en-US/login.json b/web/i18n/locales/en-US/login.jsonindex 685ec31751e..2a38fa7933c 100644--- a/web/i18n/locales/en-US/login.json+++ b/web/i18n/locales/en-US/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Please enter your email address to reset your password. We will send you an email with instructions on how to reset your password.","go": "Go to Dify","goToInit": "If you have not initialized the account, please go to the initialization page",- "hidePassword": "Hide password","installBtn": "Set up","interfaceLanguage": "Interface Language","invalid": "The link has expired",diff --git a/web/i18n/locales/es-ES/login.json b/web/i18n/locales/es-ES/login.jsonindex 95a4ae3a432..28e4e0aee36 100644--- a/web/i18n/locales/es-ES/login.json+++ b/web/i18n/locales/es-ES/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Por favor, ingresa tu dirección de correo electrónico para restablecer tu contraseña. Te enviaremos un correo electrónico con instrucciones sobre cómo restablecer tu contraseña.","go": "Ir a Dify","goToInit": "Si no has inicializado la cuenta, por favor ve a la página de inicialización",- "hidePassword": "Ocultar contraseña","installBtn": "Configurar","interfaceLanguage": "Idioma de interfaz","invalid": "El enlace ha expirado",diff --git a/web/i18n/locales/fa-IR/login.json b/web/i18n/locales/fa-IR/login.jsonindex c84df67cda6..3bed2398903 100644--- a/web/i18n/locales/fa-IR/login.json+++ b/web/i18n/locales/fa-IR/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "لطفاً آدرس ایمیل خود را وارد کنید تا رمز عبور خود را بازنشانی کنید. ما یک ایمیل با دستورالعملهای بازنشانی برای شما ارسال خواهیم کرد.","go": "برو به Dify","goToInit": "اگر حساب را اولیه نکردهاید، لطفاً به صفحه اولیهسازی بروید",- "hidePassword": "پنهان کردن رمز عبور","installBtn": "راهاندازی","interfaceLanguage": "زبان رابط کاربری","invalid": "لینک منقضی شده است",diff --git a/web/i18n/locales/fr-FR/login.json b/web/i18n/locales/fr-FR/login.jsonindex 7bb34e26a97..6c177a2d8fd 100644--- a/web/i18n/locales/fr-FR/login.json+++ b/web/i18n/locales/fr-FR/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Veuillez entrer votre adresse e-mail pour réinitialiser votre mot de passe. Nous vous enverrons un e-mail avec des instructions sur la réinitialisation de votre mot de passe.","go": "Aller à Dify","goToInit": "Si vous n'avez pas initialisé le compte, veuillez vous rendre sur la page d'initialisation",- "hidePassword": "Masquer le mot de passe","installBtn": "Mettre en place","interfaceLanguage": "Langue de l'interface","invalid": "Le lien a expiré",diff --git a/web/i18n/locales/hi-IN/login.json b/web/i18n/locales/hi-IN/login.jsonindex ae1011051ce..6535e372f8a 100644--- a/web/i18n/locales/hi-IN/login.json+++ b/web/i18n/locales/hi-IN/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "कृपया अपना ईमेल पता दर्ज करें ताकि हम आपको अपना पासवर्ड रीसेट करने के निर्देशों के साथ एक ईमेल भेज सकें।","go": "Dify पर जाएं","goToInit": "यदि आपने खाता प्रारंभ नहीं किया है, तो कृपया प्रारंभिक पृष्ठ पर जाएं",- "hidePassword": "पासवर्ड छुपाएँ","installBtn": "सेट अप करें","interfaceLanguage": "इंटरफेस भाषा","invalid": "लिंक समाप्त हो गया है",diff --git a/web/i18n/locales/id-ID/login.json b/web/i18n/locales/id-ID/login.jsonindex 4fe32c1370b..bb4d52a0f09 100644--- a/web/i18n/locales/id-ID/login.json+++ b/web/i18n/locales/id-ID/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Silakan masukkan alamat email Anda untuk mengatur ulang kata sandi Anda. Kami akan mengirimi Anda email dengan instruksi tentang cara mengatur ulang kata sandi Anda.","go": "Buka Dify","goToInit": "Jika Anda belum menginisialisasi akun, silakan buka halaman inisialisasi",- "hidePassword": "Sembunyikan kata sandi","installBtn": "Siapkan","interfaceLanguage": "Bahasa Antarmuka","invalid": "Tautan telah kedaluwarsa",diff --git a/web/i18n/locales/it-IT/login.json b/web/i18n/locales/it-IT/login.jsonindex 7dbb7d5c3db..620e28375b0 100644--- a/web/i18n/locales/it-IT/login.json+++ b/web/i18n/locales/it-IT/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Per favore inserisci il tuo indirizzo email per reimpostare la tua password. Ti invieremo una email con le istruzioni su come reimpostare la tua password.","go": "Vai a Dify","goToInit": "Se non hai inizializzato l'account, vai alla pagina di inizializzazione",- "hidePassword": "Nascondi password","installBtn": "Configura","interfaceLanguage": "Lingua dell'interfaccia","invalid": "Il link è scaduto",diff --git a/web/i18n/locales/ja-JP/login.json b/web/i18n/locales/ja-JP/login.jsonindex 1830414f4e9..a425ff99740 100644--- a/web/i18n/locales/ja-JP/login.json+++ b/web/i18n/locales/ja-JP/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "パスワードをリセットするためにメールアドレスを入力してください。パスワードのリセット方法に関する指示が記載されたメールを送信します。","go": "Dify へ移動","goToInit": "アカウントを初期化していない場合は、初期化ページに移動してください",- "hidePassword": "パスワードを非表示","installBtn": "セットアップ","interfaceLanguage": "インターフェース言語","invalid": "リンクの有効期限が切れています",diff --git a/web/i18n/locales/ko-KR/login.json b/web/i18n/locales/ko-KR/login.jsonindex b7993f2025d..3e25bfc9a87 100644--- a/web/i18n/locales/ko-KR/login.json+++ b/web/i18n/locales/ko-KR/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "비밀번호를 재설정하려면 이메일 주소를 입력하세요. 비밀번호 재설정 방법에 대한 이메일을 보내드리겠습니다.","go": "Dify 로 이동","goToInit": "계정이 초기화되지 않았다면 초기화 페이지로 이동하세요.",- "hidePassword": "비밀번호 숨기기","installBtn": "설치","interfaceLanguage": "인터페이스 언어","invalid": "링크의 유효 기간이 만료되었습니다.",diff --git a/web/i18n/locales/lo-LA/login.json b/web/i18n/locales/lo-LA/login.jsonindex b2a48152f31..4fdb2cb4ed0 100644--- a/web/i18n/locales/lo-LA/login.json+++ b/web/i18n/locales/lo-LA/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "ກະລຸນາປ້ອນທີ່ຢູ່ອີເມວຂອງທ່ານເພື່ອຕັ້ງລະຫັດຜ່ານໃໝ່. ພວກເຮົາຈະສົ່ງອີເມວພ້ອມຄຳແນະນຳວິທີການຕັ້ງລະຫັດຜ່ານໃໝ່ໃຫ້ທ່ານ.","go": "ໄປທີ່ Dify","goToInit": "ຫາກທ່ານຍັງບໍ່ທັນໄດ້ເລີ່ມຕົ້ນບັນຊີ, ກະລຸນາໄປທີ່ໜ້າການຕັ້ງຄ່າເລີ່ມຕົ້ນ",- "hidePassword": "ເຊື່ອງລະຫັດຜ່ານ","installBtn": "ຕັ້ງຄ່າລະບົບ","interfaceLanguage": "ພາສາຂອງລະບົບ","invalid": "ລິ້ງໝົດອາຍຸແລ້ວ",diff --git a/web/i18n/locales/nl-NL/login.json b/web/i18n/locales/nl-NL/login.jsonindex 879c30cfc0c..2bc5129d522 100644--- a/web/i18n/locales/nl-NL/login.json+++ b/web/i18n/locales/nl-NL/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Please enter your email address to reset your password. We will send you an email with instructions on how to reset your password.","go": "Go to Dify","goToInit": "If you have not initialized the account, please go to the initialization page",- "hidePassword": "Wachtwoord verbergen","installBtn": "Set up","interfaceLanguage": "Interface Language","invalid": "The link has expired",diff --git a/web/i18n/locales/pl-PL/login.json b/web/i18n/locales/pl-PL/login.jsonindex 78ccb2da097..5a75f4c9812 100644--- a/web/i18n/locales/pl-PL/login.json+++ b/web/i18n/locales/pl-PL/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Proszę podać swój adres e-mail, aby zresetować hasło. Wyślemy Ci e-mail z instrukcjami, jak zresetować hasło.","go": "Przejdź do Dify","goToInit": "Jeśli nie zainicjowałeś konta, przejdź do strony inicjalizacji",- "hidePassword": "Ukryj hasło","installBtn": "Ustaw","interfaceLanguage": "Język interfejsu","invalid": "Link wygasł",diff --git a/web/i18n/locales/pt-BR/login.json b/web/i18n/locales/pt-BR/login.jsonindex f8af4526f8d..17e6c202dc7 100644--- a/web/i18n/locales/pt-BR/login.json+++ b/web/i18n/locales/pt-BR/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Por favor, insira seu endereço de e-mail para redefinir sua senha. Enviaremos um e-mail com instruções sobre como redefinir sua senha.","go": "Ir para o Dify","goToInit": "Se você não inicializou a conta, vá para a página de inicialização",- "hidePassword": "Ocultar senha","installBtn": "Configuração","interfaceLanguage": "Idioma da interface","invalid": "O link expirou",diff --git a/web/i18n/locales/ro-RO/login.json b/web/i18n/locales/ro-RO/login.jsonindex 144c26b5f4a..00a784cc3d9 100644--- a/web/i18n/locales/ro-RO/login.json+++ b/web/i18n/locales/ro-RO/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Vă rugăm să introduceți adresa de e-mail pentru a reseta parola. Vă vom trimite un e-mail cu instrucțiuni despre cum să resetați parola.","go": "Mergi la Dify","goToInit": "Dacă nu ai inițializat încă contul, te rugăm să mergi la pagina de inițializare",- "hidePassword": "Ascunde parola","installBtn": "Configurare","interfaceLanguage": "Limba interfeței","invalid": "Link-ul a expirat",diff --git a/web/i18n/locales/ru-RU/login.json b/web/i18n/locales/ru-RU/login.jsonindex 9bdcc8b3d5e..f5eef6f0b47 100644--- a/web/i18n/locales/ru-RU/login.json+++ b/web/i18n/locales/ru-RU/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Пожалуйста, введите свой адрес электронной почты, чтобы сбросить пароль. Мы отправим вам электронное письмо с инструкциями о том, как сбросить пароль.","go": "Перейти к Dify","goToInit": "Если вы не инициализировали учетную запись, перейдите на страницу инициализации",- "hidePassword": "Скрыть пароль","installBtn": "Настроить","interfaceLanguage": "Язык интерфейса","invalid": "Ссылка истекла",diff --git a/web/i18n/locales/sl-SI/login.json b/web/i18n/locales/sl-SI/login.jsonindex 3c58492a777..858a9c590a7 100644--- a/web/i18n/locales/sl-SI/login.json+++ b/web/i18n/locales/sl-SI/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Prosimo, vnesite svoj e-poštni naslov za ponastavitev gesla. Poslali vam bomo e-pošto z navodili za ponastavitev gesla.","go": "Pojdi na Dify","goToInit": "Če računa še niste inicializirali, pojdite na stran za inicializacijo",- "hidePassword": "Skrij geslo","installBtn": "Namesti","interfaceLanguage": "Jezik vmesnika","invalid": "Povezava je potekla",diff --git a/web/i18n/locales/th-TH/login.json b/web/i18n/locales/th-TH/login.jsonindex 7804d05e251..a2895dc99a1 100644--- a/web/i18n/locales/th-TH/login.json+++ b/web/i18n/locales/th-TH/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "โปรดป้อนที่อยู่อีเมลของคุณเพื่อรีเซ็ตรหัสผ่านของคุณ เราจะส่งอีเมลพร้อมคําแนะนําเกี่ยวกับวิธีการรีเซ็ตรหัสผ่านของคุณ","go": "ไปที่ Dify","goToInit": "หากคุณยังไม่ได้เริ่มต้นบัญชี โปรดไปที่หน้าการเริ่มต้น",- "hidePassword": "ซ่อนรหัสผ่าน","installBtn": "สถาปนา","interfaceLanguage": "ภาษาอินเทอร์เฟซ","invalid": "ลิงก์หมดอายุ",diff --git a/web/i18n/locales/tr-TR/login.json b/web/i18n/locales/tr-TR/login.jsonindex a24d79befd5..bea1a3f40ce 100644--- a/web/i18n/locales/tr-TR/login.json+++ b/web/i18n/locales/tr-TR/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Şifrenizi sıfırlamak için e-posta adresinizi girin. Şifrenizi nasıl sıfırlayacağınıza dair talimatları içeren bir e-posta göndereceğiz.","go": "Dify'ye git","goToInit": "Hesabı başlatmadıysanız, lütfen başlatma sayfasına gidin",- "hidePassword": "Şifreyi gizle","installBtn": "Kurulum","interfaceLanguage": "Arayüz Dili","invalid": "Bağlantı süresi doldu",diff --git a/web/i18n/locales/uk-UA/login.json b/web/i18n/locales/uk-UA/login.jsonindex b5ca10c1fcf..7434e9271f6 100644--- a/web/i18n/locales/uk-UA/login.json+++ b/web/i18n/locales/uk-UA/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Будь ласка, введіть свою електронну адресу, щоб скинути пароль. Ми надішлемо вам електронного листа з інструкціями щодо скидання пароля.","go": "Перейти до Dify","goToInit": "Якщо ви ще не ініціалізували обліковий запис, перейдіть на сторінку ініціалізації",- "hidePassword": "Сховати пароль","installBtn": "Налаштувати","interfaceLanguage": "Мова інтерфейсу","invalid": "Посилання застаріло",diff --git a/web/i18n/locales/vi-VN/login.json b/web/i18n/locales/vi-VN/login.jsonindex 200b4cffdfd..1e86a36aa00 100644--- a/web/i18n/locales/vi-VN/login.json+++ b/web/i18n/locales/vi-VN/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "Vui lòng nhập địa chỉ email của bạn để đặt lại mật khẩu. Chúng tôi sẽ gửi cho bạn một email hướng dẫn cách đặt lại mật khẩu.","go": "Đi đến Dify","goToInit": "Nếu bạn chưa khởi tạo tài khoản, vui lòng chuyển đến trang khởi tạo",- "hidePassword": "Ẩn mật khẩu","installBtn": "Cài đặt","interfaceLanguage": "Ngôn ngữ giao diện","invalid": "Liên kết đã hết hạn",diff --git a/web/i18n/locales/zh-Hans/login.json b/web/i18n/locales/zh-Hans/login.jsonindex a896ec6c36f..ce0ea61d350 100644--- a/web/i18n/locales/zh-Hans/login.json+++ b/web/i18n/locales/zh-Hans/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "请输入您的电子邮件地址以重置密码。我们将向您发送一封电子邮件,包含如何重置密码的说明。","go": "跳转至 Dify","goToInit": "如果您还没有初始化账户,请前往初始化页面",- "hidePassword": "隐藏密码","installBtn": "设置","interfaceLanguage": "界面语言","invalid": "链接已失效",diff --git a/web/i18n/locales/zh-Hant/login.json b/web/i18n/locales/zh-Hant/login.jsonindex 86115971700..fb4611249e9 100644--- a/web/i18n/locales/zh-Hant/login.json+++ b/web/i18n/locales/zh-Hant/login.json@@ -37,7 +37,6 @@"forgotPasswordDesc": "請輸入您的電子郵件地址以重設密碼。我們將向您發送一封電子郵件,說明如何重設密碼。","go": "跳轉至 Dify","goToInit": "如果您還沒有初始化賬戶,請前往初始化頁面",- "hidePassword": "隱藏密碼","installBtn": "設定","interfaceLanguage": "介面語言","invalid": "連結已失效",diff --git a/web/i18n/resources.generated.d.ts b/web/i18n/resources.generated.d.tsindex dab5eeed4ca..92960643c7f 100644--- a/web/i18n/resources.generated.d.ts+++ b/web/i18n/resources.generated.d.ts@@ -4151,7 +4151,6 @@ export default interface Resources {forgotPasswordDesc: 'Please enter your email address to reset your password. We will send you an email with instructions on how to reset your password.'go: 'Go to Dify'goToInit: 'If you have not initialized the account, please go to the initialization page'- hidePassword: 'Hide password'installBtn: 'Set up'interfaceLanguage: 'Interface Language'invalid: 'The link has expired'