Browse Source

1、登录时增加密码过期校验,过期则跳转到修改密码

hella_online_20240829
bjang03 3 months ago
parent
commit
a1667dcec2
  1. 4
      src/api/system/user/index.ts
  2. 6
      src/views/login/components/LoginForm.vue
  3. 6
      src/views/login/updatePasswordNewTips.vue

4
src/api/system/user/index.ts

@ -98,7 +98,9 @@ export const updatePassword = (data : UserVO) => {
return request.put({ url: '/system/user/updatePassword', data })
}
export const getPassWordConfig = () => {
return request.get({ url: '/system/password/getConfig' })
}
// 查询用户详情
export const getUserListByDeptIds = (data : Array<number>) => {
return request.post({ url: '/system/user/getUserListByDeptIds', data })

6
src/views/login/components/LoginForm.vue

@ -276,6 +276,12 @@
//
const { wsCache } = useCache()
wsCache.set(CACHE_KEY.DEPT, await DeptApi.getSimpleDeptList())
}catch (e) {
if(e.code === 1002000010){
setTimeout(function (){
window.location.href = "/updatePasswordNewTips?username="+loginData.loginForm.username
},3000)
}
} finally {
console.log('登录-224')
getCode()

6
src/views/login/updatePasswordNewTips.vue

@ -23,7 +23,7 @@
</el-col>
</el-row>
</el-form>
<div class="tips">温馨提示<span>密码长度通常需要在6-20个字符之间</span></div>
<!-- <div class="tips">温馨提示<span>密码长度通常需要在6-20个字符之间</span></div>-->
<div class="dialog-footer">
<el-button type="primary" @click="submitForm" style="width: 100%;height: 40px;line-height: 40px;"> </el-button>
</div>
@ -54,6 +54,7 @@
password: '',
againPassword: '',
mailKey: '',
userName: route.query.username,
})
const isShowPassword = ref(false)
const isShowAgainPassword = ref(false)
@ -66,10 +67,11 @@
message.error('两次输入的密码不一致,请重新输入!')
} else {
const data = loginData as unknown as UserApi.UserVO
debugger
await UserApi.updatePassword(data)
//
message.success(t('common.updateSuccess'))
 router.go(-1)
router.go(-1)
}
} finally {
// formLoading.value = false

Loading…
Cancel
Save