Skip to content

armgit / dify

Public Imported from GitHub
0

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.

fix(web): align signin forgot-password link with text link styling (#45687)

yyh15b45d1dac2b
diff --git a/web/app/(auth)/signin/components/mail-and-password-auth.tsx b/web/app/(auth)/signin/components/mail-and-password-auth.tsx
index 24f125435eb..39297250f17 100644
--- a/web/app/(auth)/signin/components/mail-and-password-auth.tsx
+++ b/web/app/(auth)/signin/components/mail-and-password-auth.tsx
@@ -121,14 +121,18 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndP
/>
<PasswordFieldToggle aria-label={t(($) => $.showPassword, { ns: 'login' })} />
</PasswordField>
- <Link
- href={`/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'}`}
- tabIndex={isEmailSetup ? 0 : -1}
- aria-disabled={!isEmailSetup}
- >
- {t(($) => $.forget, { ns: 'login' })}
- </Link>
+ {isEmailSetup ? (
+ <Link
+ href={`/reset-password?${searchParams.toString()}`}
+ className="absolute inset-e-0 top-1 rounded-sm system-xs-regular text-text-accent outline-hidden hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid"
+ >
+ {t(($) => $.forget, { ns: 'login' })}
+ </Link>
+ ) : (
+ <span className="absolute inset-e-0 top-1 system-xs-regular text-components-button-secondary-accent-text-disabled">
+ {t(($) => $.forget, { ns: 'login' })}
+ </span>
+ )}
<FieldError>
{t(($) => $[password.trim() ? 'error.passwordInvalid' : 'error.passwordEmpty'], {
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.tsx
index aabfc4bd55f..68e52cef11e 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
@@ -86,6 +86,12 @@ describe('MailAndPasswordAuth', () => {
}
})
+ it('shows forgot password as plain text when email is not set up', () => {
+ render(<MailAndPasswordAuth isEmailSetup={false} />)
+ expect(screen.queryByRole('link', { name: 'login.forget' })).not.toBeInTheDocument()
+ expect(screen.getByText('login.forget')).toBeVisible()
+ })
+
it('submits native autofill values without input events', async () => {
const user = userEvent.setup()
render(<MailAndPasswordAuth isEmailSetup />)
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.tsx
index 20a22f0465f..5a9c66a3241 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
@@ -136,14 +136,18 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut
<FieldLabel className="py-0 text-sm leading-5 font-semibold text-text-secondary">
{t(($) => $.password, { ns: 'login' })}
</FieldLabel>
- <Link
- href={`/webapp-reset-password?${searchParams.toString()}`}
- className={`system-xs-regular ${isEmailSetup ? 'text-components-button-secondary-accent-text' : 'pointer-events-none text-components-button-secondary-accent-text-disabled'}`}
- tabIndex={isEmailSetup ? 0 : -1}
- aria-disabled={!isEmailSetup}
- >
- {t(($) => $.forget, { ns: 'login' })}
- </Link>
+ {isEmailSetup ? (
+ <Link
+ href={`/webapp-reset-password?${searchParams.toString()}`}
+ className="system-xs-regular text-text-accent hover:underline"
+ >
+ {t(($) => $.forget, { ns: 'login' })}
+ </Link>
+ ) : (
+ <span className="system-xs-regular text-components-button-secondary-accent-text-disabled">
+ {t(($) => $.forget, { ns: 'login' })}
+ </span>
+ )}
</div>
<PasswordField className="mt-1">
<PasswordFieldInput