mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 05:19:00 +08:00
feat: support login by given mail (#4991)
This commit is contained in:
parent
da5f2e168a
commit
efecdccf35
@ -39,11 +39,12 @@ const LocaleLayout = ({
|
|||||||
data-api-prefix={process.env.NEXT_PUBLIC_API_PREFIX}
|
data-api-prefix={process.env.NEXT_PUBLIC_API_PREFIX}
|
||||||
data-pubic-api-prefix={process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX}
|
data-pubic-api-prefix={process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX}
|
||||||
data-public-edition={process.env.NEXT_PUBLIC_EDITION}
|
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-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
|
||||||
data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
|
data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
|
||||||
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
|
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
|
||||||
>
|
>
|
||||||
<Topbar/>
|
<Topbar />
|
||||||
<BrowerInitor>
|
<BrowerInitor>
|
||||||
<SentryInitor>
|
<SentryInitor>
|
||||||
<I18nServer>{children}</I18nServer>
|
<I18nServer>{children}</I18nServer>
|
||||||
|
@ -7,7 +7,7 @@ import useSWR from 'swr'
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import Toast from '../components/base/toast'
|
import Toast from '../components/base/toast'
|
||||||
import style from './page.module.css'
|
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 Button from '@/app/components/base/button'
|
||||||
import { login, oauth } from '@/service/common'
|
import { login, oauth } from '@/service/common'
|
||||||
import { getPurifyHref } from '@/utils'
|
import { getPurifyHref } from '@/utils'
|
||||||
@ -62,6 +62,8 @@ function reducer(state: IState, action: IAction) {
|
|||||||
|
|
||||||
const NormalForm = () => {
|
const NormalForm = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const useEmailLogin = IS_CE_EDITION || SUPPORT_MAIL_LOGIN
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const [state, dispatch] = useReducer(reducer, {
|
const [state, dispatch] = useReducer(reducer, {
|
||||||
@ -150,7 +152,7 @@ const NormalForm = () => {
|
|||||||
|
|
||||||
<div className="w-full mx-auto mt-8">
|
<div className="w-full mx-auto mt-8">
|
||||||
<div className="bg-white ">
|
<div className="bg-white ">
|
||||||
{!IS_CE_EDITION && (
|
{!useEmailLogin && (
|
||||||
<div className="flex flex-col gap-3 mt-6">
|
<div className="flex flex-col gap-3 mt-6">
|
||||||
<div className='w-full'>
|
<div className='w-full'>
|
||||||
<a href={getPurifyHref(`${apiPrefix}/oauth/login/github`)}>
|
<a href={getPurifyHref(`${apiPrefix}/oauth/login/github`)}>
|
||||||
@ -194,7 +196,7 @@ const NormalForm = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{
|
{
|
||||||
IS_CE_EDITION && <>
|
useEmailLogin && <>
|
||||||
{/* <div className="relative mt-6">
|
{/* <div className="relative mt-6">
|
||||||
<div className="absolute inset-0 flex items-center" aria-hidden="true">
|
<div className="absolute inset-0 flex items-center" aria-hidden="true">
|
||||||
<div className="w-full border-t border-gray-300" />
|
<div className="w-full border-t border-gray-300" />
|
||||||
|
@ -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'
|
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 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 = [
|
export const TONE_LIST = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user