diff --git a/packages/client/src/components/admin/system-config/system/index.tsx b/packages/client/src/components/admin/system-config/system/index.tsx index dd1d400..0e66888 100644 --- a/packages/client/src/components/admin/system-config/system/index.tsx +++ b/packages/client/src/components/admin/system-config/system/index.tsx @@ -45,7 +45,7 @@ export const System = () => { label={{ text: '邮箱检验', extra: ( - + ), diff --git a/packages/client/src/components/user/reset-password/index.tsx b/packages/client/src/components/user/reset-password/index.tsx index 49ea201..7eeeeab 100644 --- a/packages/client/src/components/user/reset-password/index.tsx +++ b/packages/client/src/components/user/reset-password/index.tsx @@ -1,5 +1,5 @@ import { Button, Col, Form, Row, Toast, Typography } from '@douyinfe/semi-ui'; -import { useResetPassword, useVerifyCode } from 'data/user'; +import { useResetPassword, useSystemPublicConfig, useVerifyCode } from 'data/user'; import { useInterval } from 'hooks/use-interval'; import { useToggle } from 'hooks/use-toggle'; import React, { useCallback, useState } from 'react'; @@ -9,6 +9,7 @@ export const ResetPassword = ({ onSuccess }) => { const [hasSendVerifyCode, toggleHasSendVerifyCode] = useToggle(false); const [countDown, setCountDown] = useState(0); const { reset, loading } = useResetPassword(); + const { data: systemConfig } = useSystemPublicConfig(); const { sendVerifyCode, loading: sendVerifyCodeLoading } = useVerifyCode(); const onFormChange = useCallback((formState) => { @@ -67,22 +68,24 @@ export const ResetPassword = ({ onSuccess }) => { ]} /> - - - - - - - - + {systemConfig && systemConfig.enableEmailVerify ? ( + + + + + + + + + ) : null} { + const currentSystemConfig = await this.systemService.getConfigFromDatabase(); const oldData = await this.userRepo.findOne(user.id); if (oldData.email !== dto.email) { @@ -257,7 +258,10 @@ export class UserService { throw new HttpException('该邮箱已被注册', HttpStatus.BAD_REQUEST); } - if (!(await this.verifyService.checkVerifyCode(dto.email, dto.verifyCode))) { + if ( + currentSystemConfig.enableEmailVerify && + !(await this.verifyService.checkVerifyCode(dto.email, dto.verifyCode)) + ) { throw new HttpException('验证码不正确,请检查', HttpStatus.BAD_REQUEST); } }