mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-09 20:57:17 +08:00
fix: 密码过期情况下,标记用户选择是否修改密码
This commit is contained in:
@@ -98,6 +98,32 @@ const logout = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
checkPasswordExpired()
|
||||||
|
})
|
||||||
|
const checkPasswordExpired = () => {
|
||||||
|
if (!userStore.passwordExpiredShow || !userStore.userInfo.passwordExpired) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '密码已过期,是否去修改?',
|
||||||
|
hideCancel: false,
|
||||||
|
closable: true,
|
||||||
|
onBeforeOk: async () => {
|
||||||
|
try {
|
||||||
|
await router.push({ path: '/setting/profile' })
|
||||||
|
return true
|
||||||
|
} catch (error) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCancel: () => {
|
||||||
|
// 当前登录会话不再提示
|
||||||
|
userStore.passwordExpiredShow = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@@ -37,6 +37,7 @@ const storeSetup = () => {
|
|||||||
const avatar = computed(() => userInfo.avatar)
|
const avatar = computed(() => userInfo.avatar)
|
||||||
|
|
||||||
const token = ref(getToken() || '')
|
const token = ref(getToken() || '')
|
||||||
|
const passwordExpiredShow = ref<boolean>(true)
|
||||||
const roles = ref<string[]>([]) // 当前用户角色
|
const roles = ref<string[]>([]) // 当前用户角色
|
||||||
const permissions = ref<string[]>([]) // 当前角色权限标识集合
|
const permissions = ref<string[]>([]) // 当前角色权限标识集合
|
||||||
|
|
||||||
@@ -90,6 +91,7 @@ const storeSetup = () => {
|
|||||||
const logoutCallBack = async () => {
|
const logoutCallBack = async () => {
|
||||||
roles.value = []
|
roles.value = []
|
||||||
permissions.value = []
|
permissions.value = []
|
||||||
|
passwordExpiredShow.value = true
|
||||||
resetToken()
|
resetToken()
|
||||||
resetRouter()
|
resetRouter()
|
||||||
}
|
}
|
||||||
@@ -112,6 +114,7 @@ const storeSetup = () => {
|
|||||||
token,
|
token,
|
||||||
roles,
|
roles,
|
||||||
permissions,
|
permissions,
|
||||||
|
passwordExpiredShow,
|
||||||
accountLogin,
|
accountLogin,
|
||||||
emailLogin,
|
emailLogin,
|
||||||
phoneLogin,
|
phoneLogin,
|
||||||
@@ -124,5 +127,5 @@ const storeSetup = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useUserStore = defineStore('user', storeSetup, {
|
export const useUserStore = defineStore('user', storeSetup, {
|
||||||
persist: { paths: ['token', 'roles', 'permissions'], storage: localStorage }
|
persist: { paths: ['token', 'roles', 'permissions', 'passwordExpiredShow'], storage: localStorage }
|
||||||
})
|
})
|
||||||
|
@@ -94,7 +94,6 @@ const handleLogin = async () => {
|
|||||||
const { rememberMe } = loginConfig.value
|
const { rememberMe } = loginConfig.value
|
||||||
loginConfig.value.username = rememberMe ? form.username : ''
|
loginConfig.value.username = rememberMe ? form.username : ''
|
||||||
Message.success('欢迎使用')
|
Message.success('欢迎使用')
|
||||||
checkPasswordExpired()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
getCaptcha()
|
getCaptcha()
|
||||||
form.captcha = ''
|
form.captcha = ''
|
||||||
@@ -103,26 +102,6 @@ const handleLogin = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkPasswordExpired = () => {
|
|
||||||
if (!userStore.userInfo.passwordExpired) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '密码已过期,是否去修改?',
|
|
||||||
hideCancel: false,
|
|
||||||
closable: true,
|
|
||||||
onBeforeOk: async () => {
|
|
||||||
try {
|
|
||||||
await router.push({ path: '/setting/profile' })
|
|
||||||
return true
|
|
||||||
} catch (error) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const captchaImgBase64 = ref()
|
const captchaImgBase64 = ref()
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
const getCaptcha = () => {
|
const getCaptcha = () => {
|
||||||
|
Reference in New Issue
Block a user