2025-03-31 00:46:13 +08:00
|
|
|
|
import React, { useEffect, useState, useRef } from 'react';
|
2024-03-23 21:24:39 +08:00
|
|
|
|
import {
|
|
|
|
|
|
Button,
|
|
|
|
|
|
Form,
|
2025-03-31 00:46:13 +08:00
|
|
|
|
Row,
|
|
|
|
|
|
Col,
|
|
|
|
|
|
Typography,
|
2024-03-23 21:24:39 +08:00
|
|
|
|
Modal,
|
2025-03-31 00:46:13 +08:00
|
|
|
|
Banner,
|
|
|
|
|
|
TagInput,
|
|
|
|
|
|
Spin,
|
2025-04-04 17:37:52 +08:00
|
|
|
|
Card,
|
2025-03-31 00:46:13 +08:00
|
|
|
|
} from '@douyinfe/semi-ui';
|
|
|
|
|
|
const { Text } = Typography;
|
|
|
|
|
|
import {
|
2025-06-03 23:56:39 +08:00
|
|
|
|
API,
|
2025-03-31 00:46:13 +08:00
|
|
|
|
removeTrailingSlash,
|
|
|
|
|
|
showError,
|
|
|
|
|
|
showSuccess,
|
2025-06-04 00:42:06 +08:00
|
|
|
|
} from '../../helpers';
|
2025-05-09 02:00:42 +08:00
|
|
|
|
import axios from 'axios';
|
2025-07-11 02:53:53 +08:00
|
|
|
|
import { useTranslation } from 'react-i18next';
|
2024-04-16 17:12:54 +08:00
|
|
|
|
|
2023-04-22 20:39:27 +08:00
|
|
|
|
const SystemSetting = () => {
|
2025-07-11 02:53:53 +08:00
|
|
|
|
const { t } = useTranslation();
|
2024-03-15 16:05:33 +08:00
|
|
|
|
let [inputs, setInputs] = useState({
|
|
|
|
|
|
PasswordLoginEnabled: '',
|
|
|
|
|
|
PasswordRegisterEnabled: '',
|
|
|
|
|
|
EmailVerificationEnabled: '',
|
|
|
|
|
|
GitHubOAuthEnabled: '',
|
|
|
|
|
|
GitHubClientId: '',
|
|
|
|
|
|
GitHubClientSecret: '',
|
2025-03-11 22:00:31 +08:00
|
|
|
|
'oidc.enabled': '',
|
|
|
|
|
|
'oidc.client_id': '',
|
|
|
|
|
|
'oidc.client_secret': '',
|
|
|
|
|
|
'oidc.well_known': '',
|
|
|
|
|
|
'oidc.authorization_endpoint': '',
|
|
|
|
|
|
'oidc.token_endpoint': '',
|
|
|
|
|
|
'oidc.user_info_endpoint': '',
|
2024-03-15 16:05:33 +08:00
|
|
|
|
Notice: '',
|
|
|
|
|
|
SMTPServer: '',
|
|
|
|
|
|
SMTPPort: '',
|
|
|
|
|
|
SMTPAccount: '',
|
|
|
|
|
|
SMTPFrom: '',
|
|
|
|
|
|
SMTPToken: '',
|
2024-05-28 17:59:53 +08:00
|
|
|
|
WorkerUrl: '',
|
|
|
|
|
|
WorkerValidKey: '',
|
2025-05-09 02:00:42 +08:00
|
|
|
|
WorkerAllowHttpImageRequestEnabled: '',
|
2024-03-15 16:05:33 +08:00
|
|
|
|
Footer: '',
|
|
|
|
|
|
WeChatAuthEnabled: '',
|
|
|
|
|
|
WeChatServerAddress: '',
|
|
|
|
|
|
WeChatServerToken: '',
|
|
|
|
|
|
WeChatAccountQRCodeImageURL: '',
|
|
|
|
|
|
TurnstileCheckEnabled: '',
|
|
|
|
|
|
TurnstileSiteKey: '',
|
|
|
|
|
|
TurnstileSecretKey: '',
|
|
|
|
|
|
RegisterEnabled: '',
|
|
|
|
|
|
EmailDomainRestrictionEnabled: '',
|
2024-04-06 17:50:47 +08:00
|
|
|
|
EmailAliasRestrictionEnabled: '',
|
2024-03-28 12:18:11 +08:00
|
|
|
|
SMTPSSLEnabled: '',
|
2024-03-24 18:50:21 +08:00
|
|
|
|
EmailDomainWhitelist: [],
|
2024-03-15 16:05:33 +08:00
|
|
|
|
TelegramOAuthEnabled: '',
|
|
|
|
|
|
TelegramBotToken: '',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
TelegramBotName: '',
|
2024-11-10 23:56:22 +08:00
|
|
|
|
LinuxDOOAuthEnabled: '',
|
|
|
|
|
|
LinuxDOClientId: '',
|
|
|
|
|
|
LinuxDOClientSecret: '',
|
2025-07-11 02:53:53 +08:00
|
|
|
|
ServerAddress: '',
|
2024-03-15 16:05:33 +08:00
|
|
|
|
});
|
2023-07-30 12:44:41 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const [originInputs, setOriginInputs] = useState({});
|
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
|
|
|
|
const formApiRef = useRef(null);
|
|
|
|
|
|
const [emailDomainWhitelist, setEmailDomainWhitelist] = useState([]);
|
2025-04-04 12:00:38 +08:00
|
|
|
|
const [showPasswordLoginConfirmModal, setShowPasswordLoginConfirmModal] =
|
|
|
|
|
|
useState(false);
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const [linuxDOOAuthEnabled, setLinuxDOOAuthEnabled] = useState(false);
|
2025-04-16 17:11:59 +08:00
|
|
|
|
const [emailToAdd, setEmailToAdd] = useState('');
|
2024-04-16 17:12:54 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const getOptions = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
setLoading(true);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const res = await API.get('/api/option/');
|
|
|
|
|
|
const { success, message, data } = res.data;
|
|
|
|
|
|
if (success) {
|
|
|
|
|
|
let newInputs = {};
|
|
|
|
|
|
data.forEach((item) => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
switch (item.key) {
|
|
|
|
|
|
case 'TopupGroupRatio':
|
|
|
|
|
|
item.value = JSON.stringify(JSON.parse(item.value), null, 2);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'EmailDomainWhitelist':
|
|
|
|
|
|
setEmailDomainWhitelist(item.value ? item.value.split(',') : []);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PasswordLoginEnabled':
|
|
|
|
|
|
case 'PasswordRegisterEnabled':
|
|
|
|
|
|
case 'EmailVerificationEnabled':
|
|
|
|
|
|
case 'GitHubOAuthEnabled':
|
|
|
|
|
|
case 'WeChatAuthEnabled':
|
|
|
|
|
|
case 'TelegramOAuthEnabled':
|
|
|
|
|
|
case 'RegisterEnabled':
|
|
|
|
|
|
case 'TurnstileCheckEnabled':
|
|
|
|
|
|
case 'EmailDomainRestrictionEnabled':
|
|
|
|
|
|
case 'EmailAliasRestrictionEnabled':
|
|
|
|
|
|
case 'SMTPSSLEnabled':
|
|
|
|
|
|
case 'LinuxDOOAuthEnabled':
|
|
|
|
|
|
case 'oidc.enabled':
|
2025-05-09 02:00:42 +08:00
|
|
|
|
case 'WorkerAllowHttpImageRequestEnabled':
|
2025-03-31 00:46:13 +08:00
|
|
|
|
item.value = item.value === 'true';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'Price':
|
|
|
|
|
|
case 'MinTopUp':
|
|
|
|
|
|
item.value = parseFloat(item.value);
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2023-09-09 03:11:42 +08:00
|
|
|
|
}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
newInputs[item.key] = item.value;
|
|
|
|
|
|
});
|
2025-03-31 00:46:13 +08:00
|
|
|
|
setInputs(newInputs);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
setOriginInputs(newInputs);
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (formApiRef.current) {
|
|
|
|
|
|
formApiRef.current.setValues(newInputs);
|
|
|
|
|
|
}
|
|
|
|
|
|
setIsLoaded(true);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
showError(message);
|
|
|
|
|
|
}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
setLoading(false);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
useEffect(() => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
getOptions();
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}, []);
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const updateOptions = async (options) => {
|
2024-03-15 16:05:33 +08:00
|
|
|
|
setLoading(true);
|
2025-03-31 00:46:13 +08:00
|
|
|
|
try {
|
|
|
|
|
|
// 分离 checkbox 类型的选项和其他选项
|
2025-04-04 12:00:38 +08:00
|
|
|
|
const checkboxOptions = options.filter((opt) =>
|
|
|
|
|
|
opt.key.toLowerCase().endsWith('enabled'),
|
2025-03-31 00:46:13 +08:00
|
|
|
|
);
|
2025-04-04 12:00:38 +08:00
|
|
|
|
const otherOptions = options.filter(
|
|
|
|
|
|
(opt) => !opt.key.toLowerCase().endsWith('enabled'),
|
2025-03-31 00:46:13 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// 处理 checkbox 类型的选项
|
|
|
|
|
|
for (const opt of checkboxOptions) {
|
|
|
|
|
|
const res = await API.put('/api/option/', {
|
|
|
|
|
|
key: opt.key,
|
2025-04-04 12:00:38 +08:00
|
|
|
|
value: opt.value.toString(),
|
2025-03-31 00:46:13 +08:00
|
|
|
|
});
|
|
|
|
|
|
if (!res.data.success) {
|
|
|
|
|
|
showError(res.data.message);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
|
|
|
|
|
// 处理其他选项
|
|
|
|
|
|
if (otherOptions.length > 0) {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
const requestQueue = otherOptions.map((opt) =>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
API.put('/api/option/', {
|
|
|
|
|
|
key: opt.key,
|
2025-04-04 12:00:38 +08:00
|
|
|
|
value:
|
|
|
|
|
|
typeof opt.value === 'boolean' ? opt.value.toString() : opt.value,
|
|
|
|
|
|
}),
|
2025-03-31 00:46:13 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const results = await Promise.all(requestQueue);
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
// 检查所有请求是否成功
|
2025-04-04 12:00:38 +08:00
|
|
|
|
const errorResults = results.filter((res) => !res.data.success);
|
|
|
|
|
|
errorResults.forEach((res) => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
showError(res.data.message);
|
|
|
|
|
|
});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showSuccess(t('更新成功'));
|
2025-03-31 00:46:13 +08:00
|
|
|
|
// 更新本地状态
|
|
|
|
|
|
const newInputs = { ...inputs };
|
2025-04-04 12:00:38 +08:00
|
|
|
|
options.forEach((opt) => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
newInputs[opt.key] = opt.value;
|
|
|
|
|
|
});
|
|
|
|
|
|
setInputs(newInputs);
|
|
|
|
|
|
} catch (error) {
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showError(t('更新失败'));
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
};
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const handleFormChange = (values) => {
|
|
|
|
|
|
setInputs(values);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
2024-05-28 17:59:53 +08:00
|
|
|
|
const submitWorker = async () => {
|
|
|
|
|
|
let WorkerUrl = removeTrailingSlash(inputs.WorkerUrl);
|
2025-04-19 00:20:25 +08:00
|
|
|
|
const options = [
|
2025-03-31 00:46:13 +08:00
|
|
|
|
{ key: 'WorkerUrl', value: WorkerUrl },
|
2025-05-09 02:00:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
key: 'WorkerAllowHttpImageRequestEnabled',
|
|
|
|
|
|
value: inputs.WorkerAllowHttpImageRequestEnabled ? 'true' : 'false',
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
2025-04-19 00:20:25 +08:00
|
|
|
|
if (inputs.WorkerValidKey !== '' || WorkerUrl === '') {
|
|
|
|
|
|
options.push({ key: 'WorkerValidKey', value: inputs.WorkerValidKey });
|
|
|
|
|
|
}
|
|
|
|
|
|
await updateOptions(options);
|
2024-11-10 23:56:22 +08:00
|
|
|
|
};
|
2024-05-28 17:59:53 +08:00
|
|
|
|
|
2025-07-11 02:53:53 +08:00
|
|
|
|
const submitServerAddress = async () => {
|
|
|
|
|
|
let ServerAddress = removeTrailingSlash(inputs.ServerAddress);
|
|
|
|
|
|
await updateOptions([{ key: 'ServerAddress', value: ServerAddress }]);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const submitSMTP = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [];
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
if (originInputs['SMTPServer'] !== inputs.SMTPServer) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'SMTPServer', value: inputs.SMTPServer });
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (originInputs['SMTPAccount'] !== inputs.SMTPAccount) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'SMTPAccount', value: inputs.SMTPAccount });
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (originInputs['SMTPFrom'] !== inputs.SMTPFrom) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'SMTPFrom', value: inputs.SMTPFrom });
|
|
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['SMTPPort'] !== inputs.SMTPPort &&
|
|
|
|
|
|
inputs.SMTPPort !== ''
|
|
|
|
|
|
) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'SMTPPort', value: inputs.SMTPPort });
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['SMTPToken'] !== inputs.SMTPToken &&
|
|
|
|
|
|
inputs.SMTPToken !== ''
|
|
|
|
|
|
) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'SMTPToken', value: inputs.SMTPToken });
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (options.length > 0) {
|
|
|
|
|
|
await updateOptions(options);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2023-07-30 12:44:41 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const submitEmailDomainWhitelist = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (Array.isArray(emailDomainWhitelist)) {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
await updateOptions([
|
|
|
|
|
|
{
|
|
|
|
|
|
key: 'EmailDomainWhitelist',
|
|
|
|
|
|
value: emailDomainWhitelist.join(','),
|
|
|
|
|
|
},
|
|
|
|
|
|
]);
|
2025-03-31 00:46:13 +08:00
|
|
|
|
} else {
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showError(t('邮箱域名白名单格式不正确'));
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
2025-04-16 17:11:59 +08:00
|
|
|
|
const handleAddEmail = () => {
|
|
|
|
|
|
if (emailToAdd && emailToAdd.trim() !== '') {
|
|
|
|
|
|
const domain = emailToAdd.trim();
|
|
|
|
|
|
|
|
|
|
|
|
// 验证域名格式
|
2025-05-09 02:00:42 +08:00
|
|
|
|
const domainRegex =
|
|
|
|
|
|
/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
2025-04-16 17:11:59 +08:00
|
|
|
|
if (!domainRegex.test(domain)) {
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showError(t('邮箱域名格式不正确,请输入有效的域名,如 gmail.com'));
|
2025-04-16 17:11:59 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否已存在
|
|
|
|
|
|
if (emailDomainWhitelist.includes(domain)) {
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showError(t('该域名已存在于白名单中'));
|
2025-04-16 17:11:59 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setEmailDomainWhitelist([...emailDomainWhitelist, domain]);
|
|
|
|
|
|
setEmailToAdd('');
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showSuccess(t('已添加到白名单'));
|
2025-04-16 17:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const submitWeChat = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [];
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
if (originInputs['WeChatServerAddress'] !== inputs.WeChatServerAddress) {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'WeChatServerAddress',
|
|
|
|
|
|
value: removeTrailingSlash(inputs.WeChatServerAddress),
|
2025-03-31 00:46:13 +08:00
|
|
|
|
});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['WeChatAccountQRCodeImageURL'] !==
|
|
|
|
|
|
inputs.WeChatAccountQRCodeImageURL
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'WeChatAccountQRCodeImageURL',
|
|
|
|
|
|
value: inputs.WeChatAccountQRCodeImageURL,
|
2025-03-31 00:46:13 +08:00
|
|
|
|
});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['WeChatServerToken'] !== inputs.WeChatServerToken &&
|
|
|
|
|
|
inputs.WeChatServerToken !== ''
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'WeChatServerToken',
|
|
|
|
|
|
value: inputs.WeChatServerToken,
|
|
|
|
|
|
});
|
2025-03-31 00:46:13 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (options.length > 0) {
|
|
|
|
|
|
await updateOptions(options);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const submitGitHubOAuth = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [];
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
if (originInputs['GitHubClientId'] !== inputs.GitHubClientId) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'GitHubClientId', value: inputs.GitHubClientId });
|
|
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['GitHubClientSecret'] !== inputs.GitHubClientSecret &&
|
|
|
|
|
|
inputs.GitHubClientSecret !== ''
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'GitHubClientSecret',
|
|
|
|
|
|
value: inputs.GitHubClientSecret,
|
|
|
|
|
|
});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (options.length > 0) {
|
|
|
|
|
|
await updateOptions(options);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2024-03-01 20:39:28 +08:00
|
|
|
|
|
2025-02-28 15:18:03 +08:00
|
|
|
|
const submitOIDCSettings = async () => {
|
2025-04-24 21:03:55 +08:00
|
|
|
|
if (inputs['oidc.well_known'] && inputs['oidc.well_known'] !== '') {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
!inputs['oidc.well_known'].startsWith('http://') &&
|
|
|
|
|
|
!inputs['oidc.well_known'].startsWith('https://')
|
|
|
|
|
|
) {
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showError(t('Well-Known URL 必须以 http:// 或 https:// 开头'));
|
2025-02-28 15:18:03 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
2025-04-25 09:51:01 +08:00
|
|
|
|
const res = await axios.create().get(inputs['oidc.well_known']);
|
2025-04-04 12:00:38 +08:00
|
|
|
|
inputs['oidc.authorization_endpoint'] =
|
|
|
|
|
|
res.data['authorization_endpoint'];
|
2025-03-11 22:00:31 +08:00
|
|
|
|
inputs['oidc.token_endpoint'] = res.data['token_endpoint'];
|
|
|
|
|
|
inputs['oidc.user_info_endpoint'] = res.data['userinfo_endpoint'];
|
2025-07-11 02:53:53 +08:00
|
|
|
|
showSuccess(t('获取 OIDC 配置成功!'));
|
2025-02-28 15:18:03 +08:00
|
|
|
|
} catch (err) {
|
2025-03-11 23:20:27 +08:00
|
|
|
|
console.error(err);
|
2025-04-04 12:00:38 +08:00
|
|
|
|
showError(
|
2025-07-11 02:53:53 +08:00
|
|
|
|
t('获取 OIDC 配置失败,请检查网络状况和 Well-Known URL 是否正确'),
|
2025-04-04 12:00:38 +08:00
|
|
|
|
);
|
2025-03-31 00:46:13 +08:00
|
|
|
|
return;
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [];
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-11 22:00:31 +08:00
|
|
|
|
if (originInputs['oidc.well_known'] !== inputs['oidc.well_known']) {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'oidc.well_known',
|
|
|
|
|
|
value: inputs['oidc.well_known'],
|
|
|
|
|
|
});
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
2025-03-11 22:00:31 +08:00
|
|
|
|
if (originInputs['oidc.client_id'] !== inputs['oidc.client_id']) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'oidc.client_id', value: inputs['oidc.client_id'] });
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['oidc.client_secret'] !== inputs['oidc.client_secret'] &&
|
|
|
|
|
|
inputs['oidc.client_secret'] !== ''
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'oidc.client_secret',
|
|
|
|
|
|
value: inputs['oidc.client_secret'],
|
|
|
|
|
|
});
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['oidc.authorization_endpoint'] !==
|
|
|
|
|
|
inputs['oidc.authorization_endpoint']
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'oidc.authorization_endpoint',
|
|
|
|
|
|
value: inputs['oidc.authorization_endpoint'],
|
|
|
|
|
|
});
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
2025-03-11 22:00:31 +08:00
|
|
|
|
if (originInputs['oidc.token_endpoint'] !== inputs['oidc.token_endpoint']) {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'oidc.token_endpoint',
|
|
|
|
|
|
value: inputs['oidc.token_endpoint'],
|
|
|
|
|
|
});
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['oidc.user_info_endpoint'] !==
|
|
|
|
|
|
inputs['oidc.user_info_endpoint']
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'oidc.user_info_endpoint',
|
|
|
|
|
|
value: inputs['oidc.user_info_endpoint'],
|
|
|
|
|
|
});
|
2025-02-28 15:18:03 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (options.length > 0) {
|
|
|
|
|
|
await updateOptions(options);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-02-28 15:18:03 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const submitTelegramSettings = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [
|
|
|
|
|
|
{ key: 'TelegramBotToken', value: inputs.TelegramBotToken },
|
2025-04-04 12:00:38 +08:00
|
|
|
|
{ key: 'TelegramBotName', value: inputs.TelegramBotName },
|
2025-03-31 00:46:13 +08:00
|
|
|
|
];
|
|
|
|
|
|
await updateOptions(options);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
2023-09-09 03:11:42 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const submitTurnstile = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [];
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
if (originInputs['TurnstileSiteKey'] !== inputs.TurnstileSiteKey) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'TurnstileSiteKey', value: inputs.TurnstileSiteKey });
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['TurnstileSecretKey'] !== inputs.TurnstileSecretKey &&
|
|
|
|
|
|
inputs.TurnstileSecretKey !== ''
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'TurnstileSecretKey',
|
|
|
|
|
|
value: inputs.TurnstileSecretKey,
|
|
|
|
|
|
});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (options.length > 0) {
|
|
|
|
|
|
await updateOptions(options);
|
2023-07-30 12:44:41 +08:00
|
|
|
|
}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
2023-07-30 12:44:41 +08:00
|
|
|
|
|
2024-11-10 23:56:22 +08:00
|
|
|
|
const submitLinuxDOOAuth = async () => {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const options = [];
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2024-11-10 23:56:22 +08:00
|
|
|
|
if (originInputs['LinuxDOClientId'] !== inputs.LinuxDOClientId) {
|
2025-03-31 00:46:13 +08:00
|
|
|
|
options.push({ key: 'LinuxDOClientId', value: inputs.LinuxDOClientId });
|
2024-11-10 23:56:22 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
if (
|
|
|
|
|
|
originInputs['LinuxDOClientSecret'] !== inputs.LinuxDOClientSecret &&
|
|
|
|
|
|
inputs.LinuxDOClientSecret !== ''
|
|
|
|
|
|
) {
|
|
|
|
|
|
options.push({
|
|
|
|
|
|
key: 'LinuxDOClientSecret',
|
|
|
|
|
|
value: inputs.LinuxDOClientSecret,
|
|
|
|
|
|
});
|
2025-03-31 00:46:13 +08:00
|
|
|
|
}
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (options.length > 0) {
|
|
|
|
|
|
await updateOptions(options);
|
2024-11-10 23:56:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
const handleCheckboxChange = async (optionKey, event) => {
|
|
|
|
|
|
const value = event.target.checked;
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
if (optionKey === 'PasswordLoginEnabled' && !value) {
|
|
|
|
|
|
setShowPasswordLoginConfirmModal(true);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
await updateOptions([{ key: optionKey, value }]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (optionKey === 'LinuxDOOAuthEnabled') {
|
|
|
|
|
|
setLinuxDOOAuthEnabled(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handlePasswordLoginConfirm = async () => {
|
|
|
|
|
|
await updateOptions([{ key: 'PasswordLoginEnabled', value: false }]);
|
|
|
|
|
|
setShowPasswordLoginConfirmModal(false);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
return (
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<div>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
{isLoaded ? (
|
|
|
|
|
|
<Form
|
|
|
|
|
|
initValues={inputs}
|
|
|
|
|
|
onValueChange={handleFormChange}
|
|
|
|
|
|
getFormApi={(api) => (formApiRef.current = api)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{({ formState, values, formApi }) => (
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<div
|
|
|
|
|
|
style={{
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
|
gap: '10px',
|
|
|
|
|
|
marginTop: '10px',
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('通用设置')}>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={24} lg={24} xl={24}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='ServerAddress'
|
|
|
|
|
|
label={t('服务器地址')}
|
|
|
|
|
|
placeholder='https://yourdomain.com'
|
|
|
|
|
|
extraText={t('该服务器地址将影响支付回调地址以及默认首页展示的地址,请确保正确配置')}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Button onClick={submitServerAddress}>{t('更新服务器地址')}</Button>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
|
|
<Form.Section text={t('代理设置')}>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Text>
|
|
|
|
|
|
(支持{' '}
|
|
|
|
|
|
<a
|
|
|
|
|
|
href='https://github.com/Calcium-Ion/new-api-worker'
|
|
|
|
|
|
target='_blank'
|
|
|
|
|
|
rel='noreferrer'
|
2025-03-31 00:46:13 +08:00
|
|
|
|
>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
new-api-worker
|
|
|
|
|
|
</a>
|
|
|
|
|
|
)
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='WorkerUrl'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Worker地址')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
placeholder='例如:https://workername.yourdomain.workers.dev'
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='WorkerValidKey'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Worker密钥')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
placeholder='敏感信息不会发送到前端显示'
|
|
|
|
|
|
type='password'
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
2025-05-09 02:00:42 +08:00
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='WorkerAllowHttpImageRequestEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许 HTTP 协议图片请求(适用于自部署代理)')}
|
2025-05-09 02:00:42 +08:00
|
|
|
|
</Form.Checkbox>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Button onClick={submitWorker}>{t('更新Worker设置')}</Button>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置登录注册')}>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='PasswordLoginEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('PasswordLoginEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过密码进行登录')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='PasswordRegisterEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('PasswordRegisterEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过密码进行注册')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='EmailVerificationEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('EmailVerificationEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('通过密码注册时需要进行邮箱验证')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='RegisterEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('RegisterEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许新用户注册')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='TurnstileCheckEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('TurnstileCheckEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许 Turnstile 用户校验')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='GitHubOAuthEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('GitHubOAuthEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过 GitHub 账户登录 & 注册')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='LinuxDOOAuthEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('LinuxDOOAuthEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过 Linux DO 账户登录 & 注册')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='WeChatAuthEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('WeChatAuthEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过微信登录 & 注册')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='TelegramOAuthEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('TelegramOAuthEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过 Telegram 进行登录')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
<Form.Checkbox
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.enabled']"
|
2025-04-04 17:37:52 +08:00
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('oidc.enabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('允许通过 OIDC 进行登录')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置邮箱域名白名单')}>
|
|
|
|
|
|
<Text>{t('用以防止恶意用户利用临时邮箱批量注册')}</Text>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='EmailDomainRestrictionEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange(
|
|
|
|
|
|
'EmailDomainRestrictionEnabled',
|
|
|
|
|
|
e,
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
启用邮箱域名白名单
|
|
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='EmailAliasRestrictionEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange(
|
|
|
|
|
|
'EmailAliasRestrictionEnabled',
|
|
|
|
|
|
e,
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
启用邮箱别名限制
|
|
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<TagInput
|
|
|
|
|
|
value={emailDomainWhitelist}
|
|
|
|
|
|
onChange={setEmailDomainWhitelist}
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('输入域名后回车')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
style={{ width: '100%', marginTop: 16 }}
|
|
|
|
|
|
/>
|
2025-04-16 17:11:59 +08:00
|
|
|
|
<Form.Input
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('输入要添加的邮箱域名')}
|
2025-04-16 17:11:59 +08:00
|
|
|
|
value={emailToAdd}
|
|
|
|
|
|
onChange={(value) => setEmailToAdd(value)}
|
|
|
|
|
|
style={{ marginTop: 16 }}
|
|
|
|
|
|
suffix={
|
2025-05-09 02:00:42 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
theme='solid'
|
|
|
|
|
|
type='primary'
|
|
|
|
|
|
onClick={handleAddEmail}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('添加')}
|
2025-05-09 02:00:42 +08:00
|
|
|
|
</Button>
|
2025-04-16 17:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
onEnterPress={handleAddEmail}
|
|
|
|
|
|
/>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
onClick={submitEmailDomainWhitelist}
|
|
|
|
|
|
style={{ marginTop: 10 }}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('保存邮箱域名白名单设置')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 SMTP')}>
|
|
|
|
|
|
<Text>{t('用以支持系统的邮件发送')}</Text>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Input field='SMTPServer' label={t('SMTP 服务器地址')} />
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Input field='SMTPPort' label={t('SMTP 端口')} />
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Input field='SMTPAccount' label={t('SMTP 账户')} />
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
style={{ marginTop: 16 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Input field='SMTPFrom' label={t('SMTP 发送者邮箱')} />
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='SMTPToken'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('SMTP 访问凭证')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
|
|
|
|
|
placeholder='敏感信息不会发送到前端显示'
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
|
|
|
|
|
<Form.Checkbox
|
|
|
|
|
|
field='SMTPSSLEnabled'
|
|
|
|
|
|
noLabel
|
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
|
handleCheckboxChange('SMTPSSLEnabled', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('启用SMTP SSL')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Checkbox>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Button onClick={submitSMTP}>{t('保存 SMTP 设置')}</Button>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 OIDC')}>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Text>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('用以支持通过 OIDC 登录,例如 Okta、Auth0 等兼容 OIDC 协议的 IdP')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Text>
|
|
|
|
|
|
<Banner
|
|
|
|
|
|
type='info'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
description={`${t('主页链接填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')},${t('重定向 URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/oidc`}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
style={{ marginBottom: 20, marginTop: 16 }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<Text>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('若你的 OIDC Provider 支持 Discovery Endpoint,你可以仅填写 OIDC Well-Known URL,系统会自动获取 OIDC 配置')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Text>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.well_known']"
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Well-Known URL')}
|
|
|
|
|
|
placeholder={t('请输入 OIDC 的 Well-Known URL')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.client_id']"
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Client ID')}
|
|
|
|
|
|
placeholder={t('输入 OIDC 的 Client ID')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.client_secret']"
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Client Secret')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('敏感信息不会发送到前端显示')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.authorization_endpoint']"
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Authorization Endpoint')}
|
|
|
|
|
|
placeholder={t('输入 OIDC 的 Authorization Endpoint')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.token_endpoint']"
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Token Endpoint')}
|
|
|
|
|
|
placeholder={t('输入 OIDC 的 Token Endpoint')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
2025-04-16 16:27:11 +08:00
|
|
|
|
field="['oidc.user_info_endpoint']"
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('User Info Endpoint')}
|
|
|
|
|
|
placeholder={t('输入 OIDC 的 Userinfo Endpoint')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Button onClick={submitOIDCSettings}>{t('保存 OIDC 设置')}</Button>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 GitHub OAuth App')}>
|
|
|
|
|
|
<Text>{t('用以支持通过 GitHub 进行登录注册')}</Text>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Banner
|
|
|
|
|
|
type='info'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
description={`${t('Homepage URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')},${t('Authorization callback URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/github`}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
style={{ marginBottom: 20, marginTop: 16 }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='GitHubClientId'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('GitHub Client ID')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='GitHubClientSecret'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('GitHub Client Secret')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('敏感信息不会发送到前端显示')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Button onClick={submitGitHubOAuth}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('保存 GitHub OAuth 设置')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 Linux DO OAuth')}>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Text>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('用以支持通过 Linux DO 进行登录注册')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<a
|
|
|
|
|
|
href='https://connect.linux.do/'
|
|
|
|
|
|
target='_blank'
|
|
|
|
|
|
rel='noreferrer'
|
|
|
|
|
|
style={{
|
|
|
|
|
|
display: 'inline-block',
|
|
|
|
|
|
marginLeft: 4,
|
|
|
|
|
|
marginRight: 4,
|
|
|
|
|
|
}}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('点击此处')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</a>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('管理你的 LinuxDO OAuth App')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Text>
|
|
|
|
|
|
<Banner
|
|
|
|
|
|
type='info'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
description={`${t('回调 URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/linuxdo`}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
style={{ marginBottom: 20, marginTop: 16 }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='LinuxDOClientId'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Linux DO Client ID')}
|
|
|
|
|
|
placeholder={t('输入你注册的 LinuxDO OAuth APP 的 ID')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='LinuxDOClientSecret'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Linux DO Client Secret')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('敏感信息不会发送到前端显示')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Button onClick={submitLinuxDOOAuth}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('保存 Linux DO OAuth 设置')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 WeChat Server')}>
|
|
|
|
|
|
<Text>{t('用以支持通过微信进行登录注册')}</Text>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='WeChatServerAddress'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('WeChat Server 服务器地址')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='WeChatServerToken'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('WeChat Server 访问凭证')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('敏感信息不会发送到前端显示')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={8} lg={8} xl={8}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='WeChatAccountQRCodeImageURL'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('微信公众号二维码图片链接')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Button onClick={submitWeChat}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('保存 WeChat Server 设置')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 Telegram 登录')}>
|
|
|
|
|
|
<Text>{t('用以支持通过 Telegram 进行登录注册')}</Text>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='TelegramBotToken'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Telegram Bot Token')}
|
|
|
|
|
|
placeholder={t('敏感信息不会发送到前端显示')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='TelegramBotName'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Telegram Bot 名称')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Button onClick={submitTelegramSettings}>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
{t('保存 Telegram 登录设置')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Card>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Form.Section text={t('配置 Turnstile')}>
|
|
|
|
|
|
<Text>{t('用以支持用户校验')}</Text>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Row
|
|
|
|
|
|
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='TurnstileSiteKey'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Turnstile Site Key')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col xs={24} sm={24} md={12} lg={12} xl={12}>
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field='TurnstileSecretKey'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
label={t('Turnstile Secret Key')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
type='password'
|
2025-07-11 02:53:53 +08:00
|
|
|
|
placeholder={t('敏感信息不会发送到前端显示')}
|
2025-04-04 17:37:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<Button onClick={submitTurnstile}>{t('保存 Turnstile 设置')}</Button>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</Form.Section>
|
|
|
|
|
|
</Card>
|
2025-04-04 12:00:38 +08:00
|
|
|
|
|
2025-03-31 00:46:13 +08:00
|
|
|
|
<Modal
|
2025-07-11 02:53:53 +08:00
|
|
|
|
title={t('确认取消密码登录')}
|
2025-03-31 00:46:13 +08:00
|
|
|
|
visible={showPasswordLoginConfirmModal}
|
|
|
|
|
|
onOk={handlePasswordLoginConfirm}
|
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
|
setShowPasswordLoginConfirmModal(false);
|
|
|
|
|
|
formApiRef.current.setValue('PasswordLoginEnabled', true);
|
|
|
|
|
|
}}
|
2025-07-11 02:53:53 +08:00
|
|
|
|
okText={t('确认')}
|
|
|
|
|
|
cancelText={t('取消')}
|
2024-11-10 23:56:22 +08:00
|
|
|
|
>
|
2025-07-11 02:53:53 +08:00
|
|
|
|
<p>{t('您确定要取消密码登录功能吗?这可能会影响用户的登录方式。')}</p>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
</Modal>
|
2025-04-04 17:37:52 +08:00
|
|
|
|
</div>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
)}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
</Form>
|
2025-03-31 00:46:13 +08:00
|
|
|
|
) : (
|
2025-04-04 12:00:38 +08:00
|
|
|
|
<div
|
|
|
|
|
|
style={{
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
|
height: '100vh',
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Spin size='large' />
|
2025-03-31 00:46:13 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2024-03-15 16:05:33 +08:00
|
|
|
|
);
|
2023-04-22 20:39:27 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-04 12:00:38 +08:00
|
|
|
|
export default SystemSetting;
|