forked from github/dataease
feat(X-Pack): 新增强制修改密码 #9231
This commit is contained in:
parent
bbc6064045
commit
a1bb447088
@ -8,6 +8,7 @@ import Main from './components/Main.vue'
|
||||
import CollapseBar from './components/CollapseBar.vue'
|
||||
import { ElContainer } from 'element-plus-secondary'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
const route = useRoute()
|
||||
const systemMenu = computed(() => route.path.includes('system'))
|
||||
const settingMenu = computed(() => route.path.includes('sys-setting'))
|
||||
@ -49,6 +50,7 @@ const setCollapse = () => {
|
||||
></Main>
|
||||
</el-container>
|
||||
</div>
|
||||
<XpackComponent jsname="L2NvbXBvbmVudC9sb2dpbi9Qd2RJbnZhbGlkVGlwcw==" />
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
@ -2180,7 +2180,10 @@ export default {
|
||||
frontTimeOut: '请求超时时间(秒)',
|
||||
logLiveTime: '操作日志保留时间(天)',
|
||||
platformOid: '第三方平台用户组织',
|
||||
platformRid: '第三方平台用户角色'
|
||||
platformRid: '第三方平台用户角色',
|
||||
pwdStrategy: '开启密码策略',
|
||||
dip: '禁用初始密码',
|
||||
pvp: '密码有效期'
|
||||
},
|
||||
setting_email: {
|
||||
title: '邮件设置',
|
||||
|
@ -39,7 +39,11 @@ export const logoutHandler = (justClean?: boolean) => {
|
||||
const removeCache = () => {
|
||||
const keys = Object.keys(wsCache['storage'])
|
||||
keys.forEach(key => {
|
||||
if (key.startsWith('de-plugin-') || key === 'de-platform-client') {
|
||||
if (
|
||||
key.startsWith('de-plugin-') ||
|
||||
key === 'de-platform-client' ||
|
||||
key === 'pwd-validity-period'
|
||||
) {
|
||||
wsCache.delete(key)
|
||||
}
|
||||
})
|
||||
|
@ -36,6 +36,7 @@ const footContent = ref(null)
|
||||
const loginErrorMsg = ref('')
|
||||
const xpackLoginHandler = ref()
|
||||
const showDempTips = ref(false)
|
||||
const xpackInvalidPwd = ref()
|
||||
const demoTips = computed(() => {
|
||||
if (!showDempTips.value) {
|
||||
return ''
|
||||
@ -113,6 +114,16 @@ const handleLogin = () => {
|
||||
const { token, exp } = res.data
|
||||
userStore.setToken(token)
|
||||
userStore.setExp(exp)
|
||||
if (!xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) {
|
||||
const param = {
|
||||
methodName: 'init',
|
||||
args: () => {
|
||||
duringLogin.value = false
|
||||
}
|
||||
}
|
||||
xpackInvalidPwd?.value.invokeMethod(param)
|
||||
return
|
||||
}
|
||||
const queryRedirectPath = getCurLocation()
|
||||
router.push({ path: queryRedirectPath })
|
||||
})
|
||||
@ -135,6 +146,7 @@ const tablePaneList = ref([{ title: '普通登录', name: 'simple' }])
|
||||
const xpackLoaded = info => {
|
||||
tablePaneList.value.push(info)
|
||||
}
|
||||
const xpackLoadFail = ref(false)
|
||||
|
||||
const loginContainer = ref()
|
||||
const loginContainerWidth = ref(0)
|
||||
@ -334,6 +346,11 @@ onMounted(() => {
|
||||
jsname="L2NvbXBvbmVudC9sb2dpbi9IYW5kbGVy"
|
||||
@loaded="xpackLoaded"
|
||||
/>
|
||||
<XpackComponent
|
||||
ref="xpackInvalidPwd"
|
||||
jsname="L2NvbXBvbmVudC9sb2dpbi9JbnZhbGlkUHdk"
|
||||
@load-fail="() => (xpackLoadFail = true)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="login-msg">
|
||||
|
@ -12,6 +12,13 @@ const options = [
|
||||
{ value: 'minute', label: '分钟(执行时间:0秒)' },
|
||||
{ value: 'hour', label: '小时(执行时间:0分0秒)' }
|
||||
]
|
||||
const pvpOptions = [
|
||||
{ value: '0', label: '永久' },
|
||||
{ value: '1', label: '一年' },
|
||||
{ value: '2', label: '半年' },
|
||||
{ value: '3', label: '三个月' },
|
||||
{ value: '4', label: '一个月' }
|
||||
]
|
||||
const state = reactive({
|
||||
form: reactive({
|
||||
dsIntervalTime: '30',
|
||||
@ -207,7 +214,9 @@ defineExpose({
|
||||
>
|
||||
<el-switch
|
||||
class="de-basic-switch"
|
||||
v-if="item.pkey === 'autoCreateUser'"
|
||||
v-if="
|
||||
item.pkey === 'autoCreateUser' || item.pkey === 'pwdStrategy' || item.pkey === 'dip'
|
||||
"
|
||||
active-value="true"
|
||||
inactive-value="false"
|
||||
v-model="state.form[item.pkey]"
|
||||
@ -282,6 +291,16 @@ defineExpose({
|
||||
check-on-click-node
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="item.pkey === 'pvp'">
|
||||
<el-select v-model="state.form[item.pkey]" class="edit-all-line">
|
||||
<el-option
|
||||
v-for="item in pvpOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<v-else />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -22,6 +22,13 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||
const { t } = useI18n()
|
||||
const editor = ref()
|
||||
const infoTemplate = ref()
|
||||
const pvpOptions = [
|
||||
{ value: '0', label: '永久' },
|
||||
{ value: '1', label: '一年' },
|
||||
{ value: '2', label: '半年' },
|
||||
{ value: '3', label: '三个月' },
|
||||
{ value: '4', label: '一个月' }
|
||||
]
|
||||
const tooltips = [
|
||||
{
|
||||
key: 'setting_basic.frontTimeOut',
|
||||
@ -59,6 +66,7 @@ const selectedOid = ref('')
|
||||
const selectedOName = ref('')
|
||||
const selectedRid = ref<string[]>([])
|
||||
const selectedRName = ref<string[]>([])
|
||||
const selectedPvp = ref('0')
|
||||
const search = cb => {
|
||||
const url = '/sysParameter/basic/query'
|
||||
originData = []
|
||||
@ -68,7 +76,11 @@ const search = cb => {
|
||||
const data = res.data
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
const item = data[index]
|
||||
if (item.pkey === 'basic.autoCreateUser') {
|
||||
if (
|
||||
item.pkey === 'basic.autoCreateUser' ||
|
||||
item.pkey === 'basic.dip' ||
|
||||
item.pkey === 'basic.pwdStrategy'
|
||||
) {
|
||||
item.pval = item.pval === 'true' ? '开启' : '未开启'
|
||||
} else if (item.pkey === 'basic.platformOid') {
|
||||
selectedOid.value = item.pval
|
||||
@ -89,6 +101,9 @@ const search = cb => {
|
||||
selectedRid.value = []
|
||||
item.pval = '普通角色'
|
||||
}
|
||||
} else if (item.pkey === 'basic.pvp') {
|
||||
selectedPvp.value = item.pval || '0'
|
||||
item.pval = pvpOptions.filter(cur => cur.value === selectedPvp.value)[0].label
|
||||
} else {
|
||||
item.pval = item.pval
|
||||
}
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 84ddcd508b614bab67e08ca7bdc5e7a37573f59c
|
||||
Subproject commit 922a07f77e584f46705d5f02cdef70ed8e4e0f98
|
@ -185,4 +185,9 @@ public interface UserApi {
|
||||
@Hidden
|
||||
@GetMapping("/orgAdmin")
|
||||
boolean orgAdmin();
|
||||
|
||||
@Hidden
|
||||
@GetMapping("/invalidPwd")
|
||||
InvalidPwdVO invalidPwd();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package io.dataease.api.permissions.user.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class InvalidPwdVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3684394012648654165L;
|
||||
|
||||
private boolean invalid;
|
||||
|
||||
private Long validityPeriod;
|
||||
}
|
@ -7,4 +7,6 @@ public class XpackSettingConstants {
|
||||
public static final String Front_Time_Out = "basic.frontTimeOut";
|
||||
public static final String PLATFORM_OID = "basic.platformOid";
|
||||
public static final String PLATFORM_RID = "basic.platformRid";
|
||||
public static final String DIP = "basic.dip";
|
||||
public static final String PVP = "basic.pvp";
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package io.dataease.utils;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class CalendarUtils {
|
||||
|
||||
public static Long getTimeAfterMonth(Long time, int months) {
|
||||
if (ObjectUtils.isEmpty(time)) time = System.currentTimeMillis();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
calendar.add(Calendar.MONTH, months);
|
||||
return calendar.getTimeInMillis();
|
||||
}
|
||||
}
|
@ -11,6 +11,8 @@ public class SystemSettingUtils {
|
||||
List<String> xpackSettingList = List.of(XpackSettingConstants.AUTO_CREATE_USER,
|
||||
XpackSettingConstants.LOG_LIVE_TIME,
|
||||
XpackSettingConstants.PLATFORM_OID,
|
||||
XpackSettingConstants.DIP,
|
||||
XpackSettingConstants.PVP,
|
||||
XpackSettingConstants.PLATFORM_RID);
|
||||
return xpackSettingList.contains(pkey);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user