mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
Merge pull request #10797 from dataease/pr@dev-v2@feat_default_login
feat(X-Pack): 增加默认登录方式配置功能
This commit is contained in:
commit
9f9c665975
@ -105,6 +105,11 @@ public class SysParameterManage {
|
||||
return result;
|
||||
}
|
||||
|
||||
@XpackInteract(value = "perSetting", replace = true)
|
||||
public Integer defaultLogin() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildSettingItem(String pkey, Object pval) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("pkey", pkey);
|
||||
|
@ -65,4 +65,9 @@ public class SysParameterServer implements SysParameterApi {
|
||||
public List<Object> ui() {
|
||||
return sysParameterManage.getUiList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer defaultLogin() {
|
||||
return sysParameterManage.defaultLogin();
|
||||
}
|
||||
}
|
||||
|
@ -13,3 +13,5 @@ export const logoutApi = () => request.get({ url: '/logout' })
|
||||
export const refreshApi = () => request.get({ url: '/login/refresh' })
|
||||
|
||||
export const uiLoadApi = () => request.get({ url: '/sysParameter/ui' })
|
||||
|
||||
export const loginCategoryApi = () => request.get({ url: '/sysParameter/defaultLogin' })
|
||||
|
@ -2305,7 +2305,8 @@ export default {
|
||||
platformRid: '第三方平台用户角色',
|
||||
pwdStrategy: '开启密码策略',
|
||||
dip: '禁用初始密码',
|
||||
pvp: '密码有效期'
|
||||
pvp: '密码有效期',
|
||||
defaultLogin: '默认登录方式'
|
||||
},
|
||||
setting_email: {
|
||||
title: '邮件设置',
|
||||
|
@ -3,7 +3,7 @@ import { ref, reactive, onMounted, computed, nextTick } from 'vue'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { FormRules, FormInstance } from 'element-plus-secondary'
|
||||
import { Icon } from '@/components/icon-custom'
|
||||
import { loginApi, queryDekey } from '@/api/login'
|
||||
import { loginApi, queryDekey, loginCategoryApi } from '@/api/login'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
import { CustomPassword } from '@/components/custom-password'
|
||||
@ -151,7 +151,7 @@ const xpackLoaded = info => {
|
||||
tablePaneList.value.push(info)
|
||||
}
|
||||
const xpackLoadFail = ref(false)
|
||||
|
||||
const loadingText = ref('登录中...')
|
||||
const loginContainer = ref()
|
||||
const loginContainerWidth = ref(0)
|
||||
const showLoginImage = computed<boolean>(() => {
|
||||
@ -225,10 +225,27 @@ const loadArrearance = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
loadArrearance()
|
||||
if (!checkPlatform()) {
|
||||
preheat.value = false
|
||||
const res = await loginCategoryApi()
|
||||
if (res.data) {
|
||||
debugger
|
||||
loadingText.value = '加载中...'
|
||||
document.getElementsByClassName('ed-loading-text')?.length &&
|
||||
(document.getElementsByClassName('ed-loading-text')[0]['innerText'] = loadingText.value)
|
||||
nextTick(() => {
|
||||
const param = { methodName: 'ssoLogin', args: res.data }
|
||||
const timer = setInterval(() => {
|
||||
if (xpackLoginHandler?.value.invokeMethod) {
|
||||
xpackLoginHandler?.value.invokeMethod(param)
|
||||
clearInterval(timer)
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
} else {
|
||||
preheat.value = false
|
||||
}
|
||||
}
|
||||
if (localStorage.getItem('DE-GATEWAY-FLAG')) {
|
||||
const msg = localStorage.getItem('DE-GATEWAY-FLAG')
|
||||
@ -257,7 +274,7 @@ onMounted(() => {
|
||||
ref="loginContainer"
|
||||
class="preheat-container"
|
||||
v-loading="true"
|
||||
element-loading-text="登录中..."
|
||||
:element-loading-text="loadingText"
|
||||
element-loading-background="#F5F6F7"
|
||||
/>
|
||||
<div v-show="contentShow" class="login-background" v-loading="duringLogin">
|
||||
|
@ -19,6 +19,12 @@ const pvpOptions = [
|
||||
{ value: '3', label: '三个月' },
|
||||
{ value: '4', label: '一个月' }
|
||||
]
|
||||
const loginOptions = [
|
||||
{ value: '0', label: '普通登录' },
|
||||
{ value: '1', label: 'LDAP' },
|
||||
{ value: '2', label: 'OIDC' },
|
||||
{ value: '3', label: 'CAS' }
|
||||
]
|
||||
const state = reactive({
|
||||
form: reactive({
|
||||
dsIntervalTime: '30',
|
||||
@ -323,6 +329,13 @@ defineExpose({
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="item.pkey === 'defaultLogin'">
|
||||
<el-radio-group v-model="state.form[item.pkey]">
|
||||
<el-radio v-for="item in loginOptions" :key="item.value" :label="item.value">
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<v-else />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -29,6 +29,12 @@ const pvpOptions = [
|
||||
{ value: '3', label: '三个月' },
|
||||
{ value: '4', label: '一个月' }
|
||||
]
|
||||
const loginOptions = [
|
||||
{ value: '0', label: '普通登录' },
|
||||
{ value: '1', label: 'LDAP' },
|
||||
{ value: '2', label: 'OIDC' },
|
||||
{ value: '3', label: 'CAS' }
|
||||
]
|
||||
const tooltips = [
|
||||
{
|
||||
key: 'setting_basic.frontTimeOut',
|
||||
@ -104,6 +110,8 @@ const search = cb => {
|
||||
} else if (item.pkey === 'basic.pvp') {
|
||||
selectedPvp.value = item.pval || '0'
|
||||
item.pval = pvpOptions.filter(cur => cur.value === selectedPvp.value)[0].label
|
||||
} else if (item.pkey === 'basic.defaultLogin') {
|
||||
item.pval = item.pval ? loginOptions[parseInt(item.pval)].label : loginOptions[0].label
|
||||
} else {
|
||||
item.pval = item.pval
|
||||
}
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 84536fc57e2a3a3f19bf4645c10e72fbda491c1e
|
||||
Subproject commit 6e7664b9ff1dde971b833369f6d8fa590e0fa432
|
@ -48,4 +48,8 @@ public interface SysParameterApi {
|
||||
@GetMapping("/ui")
|
||||
List<Object> ui();
|
||||
|
||||
@Hidden
|
||||
@GetMapping("/defaultLogin")
|
||||
Integer defaultLogin();
|
||||
|
||||
}
|
||||
|
@ -9,4 +9,5 @@ public class XpackSettingConstants {
|
||||
public static final String PLATFORM_RID = "basic.platformRid";
|
||||
public static final String DIP = "basic.dip";
|
||||
public static final String PVP = "basic.pvp";
|
||||
public static final String DEFAULT_LOGIN = "basic.defaultLogin";
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ public class SystemSettingUtils {
|
||||
XpackSettingConstants.PLATFORM_OID,
|
||||
XpackSettingConstants.DIP,
|
||||
XpackSettingConstants.PVP,
|
||||
XpackSettingConstants.PLATFORM_RID);
|
||||
XpackSettingConstants.PLATFORM_RID,
|
||||
XpackSettingConstants.DEFAULT_LOGIN);
|
||||
return xpackSettingList.contains(pkey);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class WhitelistUtils {
|
||||
"/sysParameter/requestTimeOut",
|
||||
"/setting/authentication/status",
|
||||
"/sysParameter/ui",
|
||||
"/sysParameter/defaultLogin",
|
||||
"/embedded/initIframe",
|
||||
"/");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user