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.

feat: support login by given mail (#4991)

Joelefecdccf35be
diff --git a/web/app/layout.tsx b/web/app/layout.tsx
index ca665fb360a..fedf66045ad 100644
--- a/web/app/layout.tsx
+++ b/web/app/layout.tsx
@@ -39,11 +39,12 @@ const LocaleLayout = ({
data-api-prefix={process.env.NEXT_PUBLIC_API_PREFIX}
data-pubic-api-prefix={process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX}
data-public-edition={process.env.NEXT_PUBLIC_EDITION}
+ data-public-support-mail-login={process.env.NEXT_PUBLIC_SUPPORT_MAIL_LOGIN}
data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
>
- <Topbar/>
+ <Topbar />
<BrowerInitor>
<SentryInitor>
<I18nServer>{children}</I18nServer>
diff --git a/web/app/signin/normalForm.tsx b/web/app/signin/normalForm.tsx
index aba658b3ce2..f6abf0d6c0f 100644
--- a/web/app/signin/normalForm.tsx
+++ b/web/app/signin/normalForm.tsx
@@ -7,7 +7,7 @@ import useSWR from 'swr'
import Link from 'next/link'
import Toast from '../components/base/toast'
import style from './page.module.css'
-import { IS_CE_EDITION, apiPrefix } from '@/config'
+import { IS_CE_EDITION, SUPPORT_MAIL_LOGIN, apiPrefix } from '@/config'
import Button from '@/app/components/base/button'
import { login, oauth } from '@/service/common'
import { getPurifyHref } from '@/utils'
@@ -62,6 +62,8 @@ function reducer(state: IState, action: IAction) {
const NormalForm = () => {
const { t } = useTranslation()
+ const useEmailLogin = IS_CE_EDITION || SUPPORT_MAIL_LOGIN
+
const router = useRouter()
const [state, dispatch] = useReducer(reducer, {
@@ -150,7 +152,7 @@ const NormalForm = () => {
<div className="w-full mx-auto mt-8">
<div className="bg-white ">
- {!IS_CE_EDITION && (
+ {!useEmailLogin && (
<div className="flex flex-col gap-3 mt-6">
<div className='w-full'>
<a href={getPurifyHref(`${apiPrefix}/oauth/login/github`)}>
@@ -194,7 +196,7 @@ const NormalForm = () => {
)}
{
- IS_CE_EDITION && <>
+ useEmailLogin && <>
{/* <div className="relative mt-6">
<div className="absolute inset-0 flex items-center" aria-hidden="true">
<div className="w-full border-t border-gray-300" />
diff --git a/web/config/index.ts b/web/config/index.ts
index 933c479b7c9..16f458d5802 100644
--- a/web/config/index.ts
+++ b/web/config/index.ts
@@ -33,6 +33,8 @@ export const PUBLIC_API_PREFIX: string = publicApiPrefix
const EDITION = process.env.NEXT_PUBLIC_EDITION || globalThis.document?.body?.getAttribute('data-public-edition') || 'SELF_HOSTED'
export const IS_CE_EDITION = EDITION === 'SELF_HOSTED'
+export const SUPPORT_MAIL_LOGIN = !!(process.env.NEXT_PUBLIC_SUPPORT_MAIL_LOGIN || globalThis.document?.body?.getAttribute('data-public-support-mail-login'))
+
export const TONE_LIST = [
{
id: 1,