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
'use client'
import { zLicenseStatus } from '@dify/contracts/api/console/system-features/zod.gen'
import { RiContractLine, RiDoorLockLine, RiErrorWarningFill } from '@remixicon/react'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import Link from '@/next/link'
import MailAndCodeAuth from './components/mail-and-code-auth'
import MailAndPasswordAuth from './components/mail-and-password-auth'
import SSOAuth from './components/sso-auth'
const NormalForm = () => {
const { t } = useTranslation(['login'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const isNonCloudEdition =
systemFeatures.deployment_edition === 'COMMUNITY' ||
systemFeatures.deployment_edition === 'ENTERPRISE'
const ssoProtocol = systemFeatures.sso_enforced_for_signin_protocol
const hasSsoLogin = systemFeatures.sso_enforced_for_signin && ssoProtocol !== null
const hasEmailLogin =
systemFeatures.enable_email_code_login || systemFeatures.enable_email_password_login
const [selectedAuthType, updateAuthType] = useState<'code' | 'password' | null>(null)
const authType =
selectedAuthType ?? (systemFeatures.enable_email_password_login ? 'password' : 'code')
const showORLine = (systemFeatures.enable_social_oauth_login || hasSsoLogin) && hasEmailLogin
const allMethodsAreDisabled =
!systemFeatures.enable_social_oauth_login && !hasEmailLogin && !hasSsoLogin
if (systemFeatures.license?.status === zLicenseStatus.enum.lost) {
return (
<div className="mx-auto mt-8 w-full">
<div className="relative">
<div className="rounded-lg bg-linear-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2 p-4">
<div className="relative mb-2 flex size-10 items-center justify-center rounded-xl bg-components-card-bg shadow">
<RiContractLine className="size-5" />
<RiErrorWarningFill className="absolute -inset-e-1 -top-1 size-4 text-text-warning-secondary" />
</div>
<p className="system-sm-medium text-text-primary">
{t(($) => $.licenseLost, { ns: 'login' })}
</p>
<p className="mt-1 system-xs-regular text-text-tertiary">
{t(($) => $.licenseLostTip, { ns: 'login' })}
</p>
</div>
</div>
</div>
)
}
if (systemFeatures.license?.status === zLicenseStatus.enum.expired) {
return (
<div className="mx-auto mt-8 w-full">
<div className="relative">
<div className="rounded-lg bg-linear-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2 p-4">
<div className="relative mb-2 flex size-10 items-center justify-center rounded-xl bg-components-card-bg shadow">
<RiContractLine className="size-5" />
<RiErrorWarningFill className="absolute -inset-e-1 -top-1 size-4 text-text-warning-secondary" />
</div>
<p className="system-sm-medium text-text-primary">
{t(($) => $.licenseExpired, { ns: 'login' })}
</p>
<p className="mt-1 system-xs-regular text-text-tertiary">
{t(($) => $.licenseExpiredTip, { ns: 'login' })}
</p>
</div>
</div>
</div>
)
}
if (systemFeatures.license?.status === zLicenseStatus.enum.inactive) {
return (
<div className="mx-auto mt-8 w-full">
<div className="relative">
<div className="rounded-lg bg-linear-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2 p-4">
<div className="relative mb-2 flex size-10 items-center justify-center rounded-xl bg-components-card-bg shadow">
<RiContractLine className="size-5" />
<RiErrorWarningFill className="absolute -inset-e-1 -top-1 size-4 text-text-warning-secondary" />
</div>
<p className="system-sm-medium text-text-primary">
{t(($) => $.licenseInactive, { ns: 'login' })}
</p>
<p className="mt-1 system-xs-regular text-text-tertiary">
{t(($) => $.licenseInactiveTip, { ns: 'login' })}
</p>
</div>
</div>
</div>
)
}
return (
<>
<div className="mx-auto mt-8 w-full">
<div className="mx-auto w-full">
<h1 className="title-4xl-semi-bold text-text-primary">
{systemFeatures.branding.enabled
? t(($) => $.pageTitleForE, { ns: 'login' })
: t(($) => $.pageTitle, { ns: 'login' })}
</h1>
<p className="mt-2 body-md-regular text-text-tertiary">
{t(($) => $.welcome, { ns: 'login' })}
</p>
</div>
<div className="relative">
<div className="mt-6 flex flex-col gap-3">
{hasSsoLogin && (
<div className="w-full">
<SSOAuth protocol={ssoProtocol} />
</div>
)}
</div>
{showORLine && (
<div className="relative mt-6">
<div className="absolute inset-0 flex items-center" aria-hidden="true">
<div className="h-px w-full bg-linear-to-r from-background-gradient-mask-transparent via-divider-regular to-background-gradient-mask-transparent"></div>
</div>
<div className="relative flex justify-center">
<span className="px-2 system-xs-medium-uppercase text-text-tertiary">
{t(($) => $.or, { ns: 'login' })}
</span>
</div>
</div>
)}
{hasEmailLogin && (
<>
{authType === 'code' ? (
<MailAndCodeAuth />
) : (
<MailAndPasswordAuth isEmailSetup={systemFeatures.is_email_setup} />
)}
{systemFeatures.enable_email_code_login &&
systemFeatures.enable_email_password_login && (
<button
type="button"
className="w-full cursor-pointer py-1 text-center"
onClick={() => {
updateAuthType(authType === 'code' ? 'password' : 'code')
}}
>
<span className="system-xs-medium text-components-button-secondary-accent-text">
{authType === 'code'
? t(($) => $.usePassword, { ns: 'login' })
: t(($) => $.useVerificationCode, { ns: 'login' })}
</span>
</button>
)}
</>
)}
{allMethodsAreDisabled && (
<>
<div className="rounded-lg bg-linear-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2 p-4">
<div className="mb-2 flex size-10 items-center justify-center rounded-xl bg-components-card-bg shadow">
<RiDoorLockLine className="size-5" />
</div>
<p className="system-sm-medium text-text-primary">
{t(($) => $.noLoginMethod, { ns: 'login' })}
</p>
<p className="mt-1 system-xs-regular text-text-tertiary">
{t(($) => $.noLoginMethodTip, { ns: 'login' })}
</p>
</div>
<div className="relative my-2 py-2">
<div className="absolute inset-0 flex items-center" aria-hidden="true">
<div className="h-px w-full bg-linear-to-r from-background-gradient-mask-transparent via-divider-regular to-background-gradient-mask-transparent"></div>
</div>
</div>
</>
)}
{!systemFeatures.branding.enabled && (
<>
<div className="mt-2 block w-full system-xs-regular text-text-tertiary">
{t(($) => $.tosDesc, { ns: 'login' })}
<Link
className="system-xs-medium text-text-secondary hover:underline"
target="_blank"
rel="noopener noreferrer"
href="https://dify.ai/terms"
>
{t(($) => $.tos, { ns: 'login' })}
</Link>
&
<Link
className="system-xs-medium text-text-secondary hover:underline"
target="_blank"
rel="noopener noreferrer"
href="https://dify.ai/privacy"
>
{t(($) => $.pp, { ns: 'login' })}
</Link>
</div>
{isNonCloudEdition && (
<div className="mt-2 block w-full system-xs-regular text-text-tertiary">
{t(($) => $.goToInit, { ns: 'login' })}
<Link
className="system-xs-medium text-text-secondary hover:underline"
href="/install"
>
{t(($) => $.setAdminAccount, { ns: 'login' })}
</Link>
</div>
)}
</>
)}
</div>
</div>
</>
)
}
export default NormalForm