mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-08 15:13:42 +08:00
limit 'LINUX DO' trust level now available
Signed-off-by: wozulong <>
This commit is contained in:
@@ -454,7 +454,7 @@ const PersonalSetting = () => {
|
||||
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
||||
<div>
|
||||
<Input
|
||||
value={userState.user && userState.user.linuxdo_id !== '' ? userState.user.linuxdo_id : '未绑定'}
|
||||
value={userState.user && userState.user.linuxdo_id !== '' ? userState.user.linuxdo_id + '(' + userState.user.linuxdo_level + '级)' : '未绑定'}
|
||||
readonly={true}
|
||||
></Input>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@ const SystemSetting = () => {
|
||||
LinuxDoOAuthEnabled: '',
|
||||
LinuxDoClientId: '',
|
||||
LinuxDoClientSecret: '',
|
||||
LinuxDoMinLevel: 0,
|
||||
Notice: '',
|
||||
SMTPServer: '',
|
||||
SMTPPort: '',
|
||||
@@ -135,6 +136,7 @@ const SystemSetting = () => {
|
||||
name === 'GitHubClientSecret' ||
|
||||
name === 'LinuxDoClientId' ||
|
||||
name === 'LinuxDoClientSecret' ||
|
||||
name === 'LinuxDoMinLevel' ||
|
||||
name === 'WeChatServerAddress' ||
|
||||
name === 'WeChatServerToken' ||
|
||||
name === 'WeChatAccountQRCodeImageURL' ||
|
||||
@@ -259,6 +261,9 @@ const SystemSetting = () => {
|
||||
) {
|
||||
await updateOption('LinuxDoClientSecret', inputs.LinuxDoClientSecret);
|
||||
}
|
||||
if (originInputs['LinuxDoMinLevel'] !== inputs.LinuxDoMinLevel) {
|
||||
await updateOption('LinuxDoMinLevel', inputs.LinuxDoMinLevel);
|
||||
}
|
||||
};
|
||||
|
||||
const submitTelegramSettings = async () => {
|
||||
@@ -634,6 +639,16 @@ const SystemSetting = () => {
|
||||
value={inputs.LinuxDoClientSecret}
|
||||
placeholder='敏感信息不会发送到前端显示'
|
||||
/>
|
||||
<Form.Input
|
||||
label='限制最低信任等级'
|
||||
name='LinuxDoMinLevel'
|
||||
onChange={handleInputChange}
|
||||
type='number'
|
||||
min={0}
|
||||
max={4}
|
||||
value={inputs.LinuxDoMinLevel}
|
||||
placeholder='输入允许使用的最低 LINUX DO 信任等级'
|
||||
/>
|
||||
</Form.Group>
|
||||
<Form.Button onClick={submitLinuxDoOAuth}>
|
||||
保存 LINUX DO OAuth 设置
|
||||
|
||||
@@ -14,13 +14,15 @@ const EditUser = (props) => {
|
||||
password: '',
|
||||
github_id: '',
|
||||
linuxdo_id: '',
|
||||
linuxdo_level: 0,
|
||||
wechat_id: '',
|
||||
telegram_id: '',
|
||||
email: '',
|
||||
quota: 0,
|
||||
group: 'default'
|
||||
});
|
||||
const [groupOptions, setGroupOptions] = useState([]);
|
||||
const { username, display_name, password, github_id, linuxdo_id, wechat_id, telegram_id, email, quota, group } =
|
||||
const { username, display_name, password, github_id, linuxdo_id, linuxdo_level, wechat_id, telegram_id, email, quota, group } =
|
||||
inputs;
|
||||
const handleInputChange = (name, value) => {
|
||||
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
||||
@@ -190,7 +192,7 @@ const EditUser = (props) => {
|
||||
</div>
|
||||
<Input
|
||||
name='linuxdo_id'
|
||||
value={linuxdo_id}
|
||||
value={linuxdo_id + '(' + linuxdo_level + '级)'}
|
||||
autoComplete='new-password'
|
||||
placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改'
|
||||
readonly
|
||||
|
||||
Reference in New Issue
Block a user