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: email reg (#135)

Joel17a811815405
diff --git a/api/libs/helper.py b/api/libs/helper.py
index 0db4363a2d2..767f368d331 100644
--- a/api/libs/helper.py
+++ b/api/libs/helper.py
@@ -21,7 +21,7 @@ class TimestampField(fields.Raw):
def email(email):
# Define a regex pattern for email addresses
- pattern = r"^[\w\.-]+@([\w-]+\.)+[\w-]{2,4}$"
+ pattern = r"^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$"
# Check if the email matches the pattern
if re.match(pattern, email) is not None:
return email
diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx
index a53373e7949..605a2dced0e 100644
--- a/web/app/install/installForm.tsx
+++ b/web/app/install/installForm.tsx
@@ -7,7 +7,7 @@ import { useRouter } from 'next/navigation'
import Toast from '../components/base/toast'
import { setup } from '@/service/common'
-const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,4}$/
+const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
const InstallForm = () => {
diff --git a/web/app/signin/normalForm.tsx b/web/app/signin/normalForm.tsx
index b7b0f0cca61..93e6b0d5615 100644
--- a/web/app/signin/normalForm.tsx
+++ b/web/app/signin/normalForm.tsx
@@ -13,7 +13,7 @@ import Button from '@/app/components/base/button'
import { login, oauth } from '@/service/common'
import { apiPrefix } from '@/config'
-const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,4}$/
+const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
type IState = {
formValid: boolean
diff --git a/web/config/index.ts b/web/config/index.ts
index 2a8ac0a1eb4..3b3453061a8 100644
--- a/web/config/index.ts
+++ b/web/config/index.ts
@@ -75,9 +75,9 @@ export const LOCALE_COOKIE_NAME = 'locale'
export const DEFAULT_VALUE_MAX_LEN = 48
-export const zhRegex = /^[\u4e00-\u9fa5]$/gm
-export const emojiRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/gm
-export const emailRegex = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,4}$/gm
+export const zhRegex = /^[\u4e00-\u9fa5]$/m
+export const emojiRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/m
+export const emailRegex = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/m
const MAX_ZN_VAR_NAME_LENGHT = 8
const MAX_EN_VAR_VALUE_LENGHT = 16
export const getMaxVarNameLength = (value: string) => {