Skip to content

Commit

Permalink
fix: 修复重置密码时未使用最新密码设置规则校验的问题 (#1933)
Browse files Browse the repository at this point in the history
  • Loading branch information
867-Jige authored Sep 23, 2024
1 parent 60072ae commit 583d03b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/pages/src/views/organization/details/UserMaterial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ export default {
id: this.currentCategoryId,
});
if (res.data) {
this.updatePasswordInfo(res.data);
res.data.forEach((item) => {
if (item.key === 'enable_password_rsa_encrypted') {
this.isRsaEncrypted = item.value;
Expand All @@ -342,6 +343,18 @@ export default {
});
}
},
// 更新密码校验规则
updatePasswordInfo(data) {
const passwordInfo = this.$convertArrayToObject(data).default;
this.passwordRules = {
passwordMinLength: passwordInfo.password_min_length,
passwordMustIncludes: passwordInfo.password_must_includes,
};
this.$store.commit('organization/updatePasswordInfo', {
id: this.currentCategoryId,
data: passwordInfo,
});
},
// 验证密码的格式
async confirmReset() {
if (!this.passwordRules) {
Expand All @@ -357,15 +370,7 @@ export default {
const res = await this.$store.dispatch('catalog/ajaxGetPassport', {
id: this.currentCategoryId,
});
const passwordInfo = this.$convertArrayToObject(res.data).default;
this.passwordRules = {
passwordMinLength: passwordInfo.password_min_length,
passwordMustIncludes: passwordInfo.password_must_includes,
};
this.$store.commit('organization/updatePasswordInfo', {
id: this.currentCategoryId,
data: passwordInfo,
});
this.updatePasswordInfo(res.data);
} catch (e) {
// 如果获取规则失败,就给后端校验
console.warn(e);
Expand Down

0 comments on commit 583d03b

Please sign in to comment.