mirror of https://github.com/langgenius/dify.git
feat: validate email according to RFC 5322 (#22540)
This commit is contained in:
parent
4b2baeea65
commit
fafb1d5fd7
|
|
@ -113,8 +113,8 @@ const EmailChangeModal = ({ onClose, email, show }: Props) => {
|
|||
}
|
||||
|
||||
const isValidEmail = (email: string): boolean => {
|
||||
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
|
||||
return emailRegex.test(email)
|
||||
const rfc5322emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
|
||||
return rfc5322emailRegex.test(email) && email.length <= 254
|
||||
}
|
||||
|
||||
const checkNewEmailExisted = async (email: string) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue