增加邮件服务功能
This commit is contained in:
@ -318,6 +318,7 @@ class LoginLog extends Component {
|
||||
onSearch={this.handleSearchByNickname}
|
||||
onChange={this.handleChangeByUserId}
|
||||
filterOption={false}
|
||||
allowClear
|
||||
>
|
||||
{userOptions}
|
||||
</Select>
|
||||
|
@ -379,6 +379,7 @@ class OfflineSession extends Component {
|
||||
onSearch={this.handleSearchByNickname}
|
||||
onChange={this.handleChangeByUserId}
|
||||
filterOption={false}
|
||||
allowClear
|
||||
>
|
||||
{userOptions}
|
||||
</Select>
|
||||
|
@ -374,6 +374,7 @@ class OnlineSession extends Component {
|
||||
onSearch={this.handleSearchByNickname}
|
||||
onChange={this.handleChangeByUserId}
|
||||
filterOption={false}
|
||||
allowClear
|
||||
>
|
||||
{userOptions}
|
||||
</Select>
|
||||
|
@ -42,6 +42,7 @@ class Setting extends Component {
|
||||
sshSettingFormRef = React.createRef();
|
||||
vncSettingFormRef = React.createRef();
|
||||
otherSettingFormRef = React.createRef();
|
||||
mailSettingFormRef = React.createRef();
|
||||
|
||||
componentDidMount() {
|
||||
this.getProperties();
|
||||
@ -98,6 +99,10 @@ class Setting extends Component {
|
||||
if (this.otherSettingFormRef.current) {
|
||||
this.otherSettingFormRef.current.setFieldsValue(properties)
|
||||
}
|
||||
|
||||
if (this.mailSettingFormRef.current) {
|
||||
this.mailSettingFormRef.current.setFieldsValue(properties)
|
||||
}
|
||||
} else {
|
||||
message.error(result['message']);
|
||||
}
|
||||
@ -561,6 +566,77 @@ class Setting extends Component {
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item {...formTailLayout}>
|
||||
<Button type="primary" htmlType="submit">
|
||||
更新
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</TabPane>
|
||||
<TabPane tab="邮箱配置" key="mail">
|
||||
<Title level={3}>Guacd 服务配置</Title>
|
||||
<Form ref={this.mailSettingFormRef} name="password" onFinish={this.changeProperties}
|
||||
layout="vertical">
|
||||
|
||||
<Form.Item
|
||||
{...formItemLayout}
|
||||
name="mail-host"
|
||||
label="邮件服务器地址"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: '邮件服务器地址',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input type='text' placeholder="请输入邮件服务器地址"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
{...formItemLayout}
|
||||
name="mail-port"
|
||||
label="邮件服务器端口"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: '邮件服务器地址',
|
||||
min: 1,
|
||||
max: 65535
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input type='number' placeholder="请输入邮件服务器地址"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
{...formItemLayout}
|
||||
name="mail-username"
|
||||
label="邮箱账号"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
type: "email",
|
||||
message: '请输入正确的邮箱账号',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input type='email' placeholder="请输入邮箱账号"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
{...formItemLayout}
|
||||
name="mail-password"
|
||||
label="邮箱密码"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: '邮箱密码',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input type='password' placeholder="请输入邮箱密码"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item {...formTailLayout}>
|
||||
<Button type="primary" htmlType="submit">
|
||||
更新
|
||||
|
@ -25,9 +25,10 @@ import UserModal from "./UserModal";
|
||||
import request from "../../common/request";
|
||||
import {message} from "antd/es";
|
||||
import {
|
||||
CheckCircleOutlined,
|
||||
DeleteOutlined,
|
||||
DownOutlined,
|
||||
ExclamationCircleOutlined,
|
||||
ExclamationCircleOutlined, InsuranceOutlined,
|
||||
LockOutlined,
|
||||
PlusOutlined,
|
||||
SyncOutlined,
|
||||
@ -58,6 +59,7 @@ class User extends Component {
|
||||
|
||||
inputRefOfNickname = React.createRef();
|
||||
inputRefOfUsername = React.createRef();
|
||||
inputRefOfMail = React.createRef();
|
||||
changePasswordFormRef = React.createRef()
|
||||
|
||||
state = {
|
||||
@ -234,6 +236,17 @@ class User extends Component {
|
||||
this.loadTableData(query);
|
||||
};
|
||||
|
||||
handleSearchByMail = mail => {
|
||||
let query = {
|
||||
...this.state.queryParams,
|
||||
'pageIndex': 1,
|
||||
'pageSize': this.state.queryParams.pageSize,
|
||||
'mail': mail,
|
||||
}
|
||||
|
||||
this.loadTableData(query);
|
||||
};
|
||||
|
||||
batchDelete = async () => {
|
||||
this.setState({
|
||||
delBtnLoading: true
|
||||
@ -327,7 +340,22 @@ class User extends Component {
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: '邮箱',
|
||||
dataIndex: 'mail',
|
||||
key: 'mail',
|
||||
}, {
|
||||
title: '二次认证',
|
||||
dataIndex: 'totpSecret',
|
||||
key: 'totpSecret',
|
||||
render: (text, record) => {
|
||||
|
||||
if (text === '1') {
|
||||
return <Tag icon={<InsuranceOutlined />} color="success">开启</Tag>;
|
||||
}else {
|
||||
return <Tag icon={<ExclamationCircleOutlined />} color="warning">关闭</Tag>;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: '在线状态',
|
||||
@ -394,6 +422,7 @@ class User extends Component {
|
||||
let result = await request.post(`/users/${record['id']}/reset-totp`);
|
||||
if (result['code'] === 1) {
|
||||
message.success('操作成功', 3);
|
||||
this.loadTableData();
|
||||
} else {
|
||||
message.error(result['message'], 10);
|
||||
}
|
||||
@ -414,7 +443,14 @@ class User extends Component {
|
||||
return (
|
||||
<div>
|
||||
<Button type="link" size='small'
|
||||
onClick={() => this.showModal('更新用户', record)}>编辑</Button>
|
||||
onClick={async () => {
|
||||
let result = await request.get(`/users/${record['id']}`);
|
||||
if (result['code'] !== 1) {
|
||||
message.error(result['message']);
|
||||
return;
|
||||
}
|
||||
this.showModal('更新用户', result['data']);
|
||||
}}>编辑</Button>
|
||||
<Dropdown overlay={menu}>
|
||||
<Button type="link" size='small'>
|
||||
更多 <DownOutlined/>
|
||||
@ -474,11 +510,19 @@ class User extends Component {
|
||||
onSearch={this.handleSearchByUsername}
|
||||
/>
|
||||
|
||||
<Search
|
||||
ref={this.inputRefOfMail}
|
||||
placeholder="邮箱"
|
||||
allowClear
|
||||
onSearch={this.handleSearchByMail}
|
||||
/>
|
||||
|
||||
<Tooltip title='重置查询'>
|
||||
|
||||
<Button icon={<UndoOutlined/>} onClick={() => {
|
||||
this.inputRefOfUsername.current.setValue('');
|
||||
this.inputRefOfNickname.current.setValue('');
|
||||
this.inputRefOfMail.current.setValue('');
|
||||
this.loadTableData({pageIndex: 1, pageSize: 10})
|
||||
}}>
|
||||
|
||||
|
@ -52,6 +52,10 @@ const UserModal = ({title, visible, handleOk, handleCancel, confirmLoading, mode
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="邮箱账号" name="mail" rules={[{required: false, type: "email", message: '请输入正确的邮箱账号',},]}>
|
||||
<Input type='email' placeholder="请输入邮箱账号"/>
|
||||
</Form.Item>
|
||||
|
||||
{
|
||||
title.indexOf('新增') > -1 ?
|
||||
(<Form.Item label="登录密码" name='password' rules={[{required: true, message: '请输入登录密码'}]}>
|
||||
|
Reference in New Issue
Block a user