fix(系统设置): 登录认证源被关闭后依然可以进行认证的问题

--bug=1020042 --user=李玉号 【系统设置】禁用OAuth2-登录ms一直是加载状态
https://www.tapd.cn/55049933/s/1301188
This commit is contained in:
shiziyuan9527 2022-11-22 15:27:24 +08:00 committed by 刘瑞斌
parent 6f8c197347
commit 46fdb49152
6 changed files with 58 additions and 30 deletions

View File

@ -119,6 +119,10 @@ public class LoginController {
return Mono.just(ResultHolder.success(authSourceService.listAllEnable())); return Mono.just(ResultHolder.success(authSourceService.listAllEnable()));
} }
@GetMapping("authsource/{authId}")
public Mono<ResultHolder> getAuthSource(@PathVariable("authId") String authId) {
return Mono.just(ResultHolder.success(authSourceService.getAuthSource(authId)));
}
@GetMapping(value = "/services") @GetMapping(value = "/services")
public Mono<ResultHolder> getServices() { public Mono<ResultHolder> getServices() {

View File

@ -57,6 +57,10 @@ export function getAuthSources() {
return get('/authsource/list/allenable') return get('/authsource/list/allenable')
} }
export function getAuthSource(id) {
return get('/authsource/' + id)
}
export function getProjectMemberOption() { export function getProjectMemberOption() {
return get('/user/project/member/option'); return get('/user/project/member/option');
} }

View File

@ -59,9 +59,17 @@
<script> <script>
import {getCurrentUserId, publicKeyEncrypt} from "../../utils/token"; import {getCurrentUserId, publicKeyEncrypt} from "../../utils/token";
import {CURRENT_LANGUAGE, DEFAULT_LANGUAGE, PRIMARY_COLOR} from "../../utils/constants"; import {DEFAULT_LANGUAGE, PRIMARY_COLOR} from "../../utils/constants";
import {hasLicense, hasPermissions, saveLicense} from "../../utils/permission"; import {hasLicense, hasPermissions, saveLicense} from "../../utils/permission";
import {checkLdapOpen, getAuthSources, getDisplayInfo, getLanguage, getSystemTheme, saveBaseUrl} from "../../api/user"; import {
checkLdapOpen,
getAuthSource,
getAuthSources,
getDisplayInfo,
getLanguage,
getSystemTheme,
saveBaseUrl
} from "../../api/user";
import {useUserStore} from "@/store" import {useUserStore} from "@/store"
import {checkMicroMode, operationConfirm} from "../../utils"; import {checkMicroMode, operationConfirm} from "../../utils";
import {getModuleList} from "../../api/module"; import {getModuleList} from "../../api/module";
@ -291,6 +299,14 @@ export default {
if (authId === 'LDAP' || authId === 'LOCAL') { if (authId === 'LDAP' || authId === 'LOCAL') {
return; return;
} }
getAuthSource(authId).then(res => {
if (!res || !res.data) {
return;
}
if (res.data.status !== 'ENABLE') {
this.$message.error(this.$t('login.auth_not_enable'));
return;
}
let source = this.authSources.filter(auth => auth.id === authId)[0]; let source = this.authSources.filter(auth => auth.id === authId)[0];
// cas // cas
if (source.type === 'CAS') { if (source.type === 'CAS') {
@ -324,6 +340,7 @@ export default {
}, () => { }, () => {
this.form.authenticate = 'LOCAL'; this.form.authenticate = 'LOCAL';
}); });
});
}, },
} }
} }

View File

@ -490,6 +490,7 @@ const message = {
}, },
login: { login: {
normal_Login: "Normal Login", normal_Login: "Normal Login",
auth_not_enable: "Authentication is not enabled"
}, },
license: { license: {
title: 'Authorization management', title: 'Authorization management',

View File

@ -493,6 +493,7 @@ const message = {
}, },
login: { login: {
normal_Login: "普通登录", normal_Login: "普通登录",
auth_not_enable: "认证未开启"
}, },
license: { license: {
title: '授权管理', title: '授权管理',

View File

@ -493,6 +493,7 @@ const message = {
}, },
login: { login: {
normal_Login: "普通登錄", normal_Login: "普通登錄",
auth_not_enable: "認證未開啟"
}, },
license: { license: {
title: '授權管理', title: '授權管理',