Merge pull request #77 from guanweiwang/main

添加 允许成员自主注册
This commit is contained in:
Yoko
2025-07-15 11:35:52 +08:00
committed by GitHub
8 changed files with 60 additions and 15 deletions

View File

@@ -190,7 +190,7 @@ export interface DomainCustomOAuth {
access_token_url?: string;
/** 自定义OAuth授权URL */
authorize_url?: string;
/** 用户信息回包中的头像URL字段名` */
/** 用户信息回包中的头像URL字段名 */
avatar_field?: string;
/** 自定义客户端ID */
client_id?: string;
@@ -202,7 +202,32 @@ export interface DomainCustomOAuth {
enable?: boolean;
/** 用户信息回包中的ID字段名 */
id_field?: string;
/** 用户信息回包中的用户名字段名` */
/** 用户信息回包中的用户名字段名 */
name_field?: string;
/** 自定义OAuth Scope列表 */
scopes?: string[];
/** 自定义OAuth用户信息URL */
userinfo_url?: string;
}
export interface DomainCustomOAuthReq {
/** 自定义OAuth访问令牌URL */
access_token_url?: string;
/** 自定义OAuth授权URL */
authorize_url?: string;
/** 用户信息回包中的头像URL字段名 */
avatar_field?: string;
/** 自定义客户端ID */
client_id?: string;
/** 自定义客户端密钥 */
client_secret?: string;
/** 用户信息回包中的邮箱字段名 */
email_field?: string;
/** 自定义OAuth开关 */
enable?: boolean;
/** 用户信息回包中的ID字段名 */
id_field?: string;
/** 用户信息回包中的用户名字段名 */
name_field?: string;
/** 自定义OAuth Scope列表 */
scopes?: string[];
@@ -219,6 +244,15 @@ export interface DomainDingtalkOAuth {
enable?: boolean;
}
export interface DomainDingtalkOAuthReq {
/** 钉钉客户端ID */
client_id?: string;
/** 钉钉客户端密钥 */
client_secret?: string;
/** 钉钉OAuth开关 */
enable?: boolean;
}
export interface DomainIPInfo {
/** ASN */
asn?: string;
@@ -397,6 +431,8 @@ export interface DomainSetting {
dingtalk_oauth?: DomainDingtalkOAuth;
/** 是否禁用密码登录 */
disable_password_login?: boolean;
/** 是否开启自动登录 */
enable_auto_login?: boolean;
/** 是否开启SSO */
enable_sso?: boolean;
/** 是否强制两步验证 */
@@ -484,11 +520,13 @@ export interface DomainUpdateModelReq {
export interface DomainUpdateSettingReq {
/** 自定义OAuth配置 */
custom_oauth?: DomainCustomOAuth;
custom_oauth?: DomainCustomOAuthReq;
/** 钉钉OAuth配置 */
dingtalk_oauth?: DomainDingtalkOAuth;
dingtalk_oauth?: DomainDingtalkOAuthReq;
/** 是否禁用密码登录 */
disable_password_login?: boolean;
/** 是否开启自动登录 */
enable_auto_login?: boolean;
/** 是否开启SSO */
enable_sso?: boolean;
/** 是否强制两步验证 */

View File

@@ -1,6 +1,6 @@
import { Button, IconButton, Stack } from '@mui/material';
import { Icon, message } from '@c-x/ui';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import LogoutIcon from '@mui/icons-material/Logout';
import DownloadIcon from '@mui/icons-material/Download';
import { Box } from '@mui/material';
@@ -8,7 +8,7 @@ import Bread from './Bread';
const Header = () => {
const navigate = useNavigate();
const { pathname } = useLocation();
return (
<Stack
direction={'row'}
@@ -44,11 +44,10 @@ const Header = () => {
},
}}
onClick={() => {
// 清除本地存储的认证信息
localStorage.removeItem('auth_token');
localStorage.removeItem('user_info');
message.success('退出登录成功');
navigate('/login', { replace: true });
navigate(pathname.startsWith('/user/') ? '/user/login' : '/login', {
replace: true,
});
}}
>
<LogoutIcon sx={{ fontSize: 16 }} />

View File

@@ -36,6 +36,7 @@ a {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
min-width: 0;
}
.multiline-ellipsis {

View File

@@ -51,7 +51,7 @@ const MainLayout = () => {
}}
>
<Sidebar />
<Stack gap={2} sx={{ flex: 1, mr: 2, ml: 0 }}>
<Stack gap={2} sx={{ flex: 1, minWidth: 0, mr: 2, ml: 0 }}>
<Header />
<Box
sx={{

View File

@@ -124,8 +124,7 @@ const MemberStatistic = ({
container
spacing={2}
sx={{
height: '100%',
overflow: 'auto',
overflowY: 'auto',
borderRadius: '10px',
}}
>

View File

@@ -110,6 +110,15 @@ const User = () => {
</Button>
</StyledCard>
<StyledCard>
<StyledLabel></StyledLabel>
<Switch
checked={data?.enable_auto_login}
onChange={(e) =>
updateSetting({ enable_auto_login: e.target.checked })
}
/>
</StyledCard>
<LoginHistory />
</Stack>
</Grid>

View File

@@ -61,7 +61,7 @@ const LoginHistory = () => {
},
];
return (
<Card sx={{ flex: 1, height: 'calc(100% - 258px)' }}>
<Card sx={{ flex: 1, height: 'calc(100% - 358px)' }}>
<Stack
direction='row'
justifyContent='space-between'

View File

@@ -120,7 +120,6 @@ const MemberStatistic = ({
container
spacing={2}
sx={{
height: '100%',
overflow: 'auto',
borderRadius: '10px',
}}