fix: allow special characters in email (#5327)

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
Mitsuki Ogasahara
2024-06-17 22:32:59 +09:00
committed by GitHub
parent edffa5666d
commit 7305713b97
4 changed files with 29 additions and 5 deletions

View File

@@ -7,11 +7,10 @@ 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, SUPPORT_MAIL_LOGIN, apiPrefix } from '@/config'
import { IS_CE_EDITION, SUPPORT_MAIL_LOGIN, apiPrefix, emailRegex } from '@/config'
import Button from '@/app/components/base/button'
import { login, oauth } from '@/service/common'
import { getPurifyHref } from '@/utils'
const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
type IState = {
formValid: boolean
@@ -78,7 +77,7 @@ const NormalForm = () => {
const [isLoading, setIsLoading] = useState(false)
const handleEmailPasswordLogin = async () => {
if (!validEmailReg.test(email)) {
if (!emailRegex.test(email)) {
Toast.notify({
type: 'error',
message: t('login.error.emailInValid'),