feat: 添加强制密码重置功能及相关组件
This commit is contained in:
@@ -9,6 +9,8 @@ import { parseUrlPath } from '@/plugins/file-static-url';
|
||||
|
||||
/**用户信息类型 */
|
||||
type UserInfo = {
|
||||
/**用户ID */
|
||||
forcePasswdChange: boolean;
|
||||
/**用户ID */
|
||||
userId: string;
|
||||
/**登录账号 */
|
||||
@@ -33,6 +35,7 @@ type UserInfo = {
|
||||
|
||||
const useUserStore = defineStore('user', {
|
||||
state: (): UserInfo => ({
|
||||
forcePasswdChange: false,
|
||||
userId: '',
|
||||
userName: '',
|
||||
roles: [],
|
||||
@@ -104,6 +107,9 @@ const useUserStore = defineStore('user', {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const token = res.data[TOKEN_RESPONSE_FIELD];
|
||||
setToken(token);
|
||||
if (res.data?.forcePasswdChange) {
|
||||
this.forcePasswdChange = true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
},
|
||||
@@ -139,6 +145,10 @@ const useUserStore = defineStore('user', {
|
||||
// }
|
||||
// useLayoutStore().changeWaterMark(waterMarkContent);
|
||||
useLayoutStore().changeWaterMark('');
|
||||
// 强制修改密码
|
||||
if (res.data?.forcePasswdChange) {
|
||||
this.forcePasswdChange = true;
|
||||
}
|
||||
}
|
||||
// 网络错误时退出登录状态
|
||||
if (res.code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user