feat: 系统配置新增安全设置功能

1、在系统配置中增加安全配置,支持配置密码策略
2、移除个人安全设置
3、在账号管理中增加修改密码功能
4、每次登录后检测密码是否过期并提示修改
This commit is contained in:
kils
2024-05-09 17:35:25 +08:00
committed by Charles7c
parent c9198b315c
commit 395a5642af
15 changed files with 290 additions and 227 deletions

View File

@@ -31,7 +31,9 @@
</a-form-item>
<a-form-item>
<a-space direction="vertical" fill class="w-full">
<a-button class="btn" type="primary" :loading="loading" html-type="submit" size="large" long>立即登录</a-button>
<a-button class="btn" type="primary" :loading="loading" html-type="submit" size="large" long
>立即登录
</a-button>
</a-space>
</a-form-item>
</a-form>
@@ -39,7 +41,7 @@
<script setup lang="ts">
import { getImageCaptcha } from '@/apis'
import { Message, type FormInstance } from '@arco-design/web-vue'
import { Message, type FormInstance, Modal } from '@arco-design/web-vue'
import { useUserStore } from '@/stores'
import { useStorage } from '@vueuse/core'
import { encryptByRsa } from '@/utils/encrypt'
@@ -92,6 +94,7 @@ const handleLogin = async () => {
const { rememberMe } = loginConfig.value
loginConfig.value.username = rememberMe ? form.username : ''
Message.success('欢迎使用')
checkPasswordExpired()
} catch (error) {
getCaptcha()
form.captcha = ''
@@ -100,6 +103,26 @@ 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 getCaptcha = () => {
@@ -151,6 +174,7 @@ onMounted(() => {
background-color: rgb(var(--danger-1));
border-color: rgb(var(--danger-3));
}
.arco-input-wrapper.arco-input-error:hover {
background-color: rgb(var(--danger-1));
border-color: rgb(var(--danger-6));
@@ -160,6 +184,7 @@ onMounted(() => {
font-size: 13px;
color: var(--color-text-1);
}
.arco-input-wrapper:hover {
border-color: rgb(var(--arcoblue-6));
}