Skip to content

Commit

Permalink
Merge pull request 79E#49 from SwaggyMacro/master
Browse files Browse the repository at this point in the history
fix: 修改登陆Modal对邮箱校验
  • Loading branch information
79E authored May 24, 2023
2 parents 4835e01 + 8e68a4d commit aa13f44
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/LoginModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RequestLoginParams } from '@/types'
import {
HeartFilled,
LockOutlined,
MobileOutlined,
MailOutlined,
RedditCircleFilled,
SlackCircleFilled,
TwitterCircleFilled
Expand Down Expand Up @@ -60,7 +60,7 @@ export function LoginCard(props: {
<ProFormText
fieldProps={{
size: 'large',
prefix: <MobileOutlined />
prefix: <MailOutlined />
}}
name="account"
placeholder="邮箱"
Expand Down Expand Up @@ -96,6 +96,15 @@ export function LoginCard(props: {
]}
onGetCaptcha={async () => {
const account = props.form.getFieldValue('account')
if (!account || !/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(account)) {
props.form.setFields([
{
name: 'account',
errors: ['请输入有效的邮箱地址']
}
])
return Promise.reject()
}
return new Promise((resolve, reject) =>
getCode({ source: account })
.then(() => resolve())
Expand Down

0 comments on commit aa13f44

Please sign in to comment.