mirror of https://github.com/fantasticit/think.git
client: fix email ui with systemConfig.enableEmailVerify
parent
c6a720887b
commit
536915753b
|
@ -1,5 +1,5 @@
|
|||
import { Button, Col, Form, Row, Toast, Typography } from '@douyinfe/semi-ui';
|
||||
import { useResetPassword, useSystemPublicConfig, useVerifyCode } from 'data/user';
|
||||
import { Button, Col, Form, Row, Toast } from '@douyinfe/semi-ui';
|
||||
import { useResetPassword, useSystemPublicConfig, useUser, useVerifyCode } from 'data/user';
|
||||
import { useInterval } from 'hooks/use-interval';
|
||||
import { useToggle } from 'hooks/use-toggle';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
@ -8,6 +8,7 @@ export const ResetPassword = ({ onSuccess }) => {
|
|||
const [email, setEmail] = useState('');
|
||||
const [hasSendVerifyCode, toggleHasSendVerifyCode] = useToggle(false);
|
||||
const [countDown, setCountDown] = useState(0);
|
||||
const { user } = useUser();
|
||||
const { reset, loading } = useResetPassword();
|
||||
const { data: systemConfig } = useSystemPublicConfig();
|
||||
const { sendVerifyCode, loading: sendVerifyCodeLoading } = useVerifyCode();
|
||||
|
@ -51,7 +52,11 @@ export const ResetPassword = ({ onSuccess }) => {
|
|||
}, [email, toggleHasSendVerifyCode, sendVerifyCode, start, stop]);
|
||||
|
||||
return (
|
||||
<Form initValues={{ name: '', password: '' }} onChange={onFormChange} onSubmit={onFinish}>
|
||||
<Form
|
||||
initValues={{ email: user.email, password: '', confirmPassword: '' }}
|
||||
onChange={onFormChange}
|
||||
onSubmit={onFinish}
|
||||
>
|
||||
<Form.Input
|
||||
noLabel
|
||||
field="email"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Avatar, Button, Col, Form, Modal, Row, Space, Toast } from '@douyinfe/semi-ui';
|
||||
import { FormApi } from '@douyinfe/semi-ui/lib/es/form';
|
||||
import { Upload } from 'components/upload';
|
||||
import { useUser, useVerifyCode } from 'data/user';
|
||||
import { useSystemPublicConfig, useUser, useVerifyCode } from 'data/user';
|
||||
import { useInterval } from 'hooks/use-interval';
|
||||
import { useToggle } from 'hooks/use-toggle';
|
||||
import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
@ -16,6 +16,7 @@ export const UserSetting: React.FC<IProps> = ({ visible, toggleVisible }) => {
|
|||
const { user, loading, updateUser } = useUser();
|
||||
const [currentAvatar, setCurrentAvatar] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
const { data: systemConfig } = useSystemPublicConfig();
|
||||
const { sendVerifyCode, loading: sendVerifyCodeLoading } = useVerifyCode();
|
||||
const [hasSendVerifyCode, toggleHasSendVerifyCode] = useToggle(false);
|
||||
const [countDown, setCountDown] = useState(0);
|
||||
|
@ -108,7 +109,7 @@ export const UserSetting: React.FC<IProps> = ({ visible, toggleVisible }) => {
|
|||
|
||||
<Form.Input label="邮箱" field="email" style={{ width: '100%' }} placeholder="请输入账户邮箱"></Form.Input>
|
||||
|
||||
{email && email !== user.email ? (
|
||||
{systemConfig && systemConfig.enableEmailVerify && email && email !== user.email ? (
|
||||
<Form.Slot label="验证码">
|
||||
<Row gutter={8}>
|
||||
<Col span={16}>
|
||||
|
|
Loading…
Reference in New Issue