Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions ui/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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[];
Expand All @@ -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;
Expand Down Expand Up @@ -397,6 +431,8 @@ export interface DomainSetting {
dingtalk_oauth?: DomainDingtalkOAuth;
/** 是否禁用密码登录 */
disable_password_login?: boolean;
/** 是否开启自动登录 */
enable_auto_login?: boolean;
/** 是否开启SSO */
enable_sso?: boolean;
/** 是否强制两步验证 */
Expand Down Expand Up @@ -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;
/** 是否强制两步验证 */
Expand Down
11 changes: 5 additions & 6 deletions ui/src/components/header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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';
import Bread from './Bread';

const Header = () => {
const navigate = useNavigate();

const { pathname } = useLocation();
return (
<Stack
direction={'row'}
Expand Down Expand Up @@ -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 }} />
Expand Down
1 change: 1 addition & 0 deletions ui/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ a {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
min-width: 0;
}

.multiline-ellipsis {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/layouts/mainLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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={{
Expand Down
3 changes: 1 addition & 2 deletions ui/src/pages/dashboard/components/memberStatistic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ const MemberStatistic = ({
container
spacing={2}
sx={{
height: '100%',
overflow: 'auto',
overflowY: 'auto',
borderRadius: '10px',
}}
>
Expand Down
9 changes: 9 additions & 0 deletions ui/src/pages/user-management/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/user-management/loginHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion ui/src/pages/user/dashboard/components/memberStatistic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ const MemberStatistic = ({
container
spacing={2}
sx={{
height: '100%',
overflow: 'auto',
borderRadius: '10px',
}}
Expand Down