Skip to content

Commit

Permalink
feat(frontend): 密码规则校验逻辑修改 TencentBlueKing#7031
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 21392
  • Loading branch information
JustaCattt committed Oct 21, 2024
1 parent 47f7c94 commit 0617ca9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
3 changes: 1 addition & 2 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3487,7 +3487,6 @@
"【MongoDB】实例视图": "【MongoDB】实例视图",
"【MongoDB】副本集集群管理": "【MongoDB】副本集集群管理",
"【MongoDB】分片集群管理": "【MongoDB】分片集群管理",
"任意 N 种, N 必须 >= 1 。且 <= 密码组成的种类": "任意 N 种, N 必须 >= 1 。且 <= 密码组成的种类",
"密码组成至少要选 1 种": "密码组成至少要选 1 种",
"请至少选择一种类型": "请至少选择一种类型",
"这行勿动!新增翻译请在上一行添加!": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
v-model="formData.number_of_types"
class="password-policy-number ml-6 mr-6"
:max="typeMaxCount"
:min="0"
:min="1"
type="number" />
{{ t('种类型') }}
</BkFormItem>
Expand Down Expand Up @@ -175,17 +175,10 @@
include_rule: [
{
trigger: 'change',
message: t('密码组成至少要选 1 种'),
message: t('请至少选择一种类型'),
validator: () => Object.values(formData.include_rule).some((checked) => checked),
},
],
number_of_types: [
{
trigger: 'change',
message: t('任意 N 种, N 必须 >= 1 。且 <= 密码组成的种类'),
validator: () => formData.number_of_types >= 1 && formData.number_of_types <= typeMaxCount.value,
},
],
};

const defaultConfig = reactive(initData());
Expand Down Expand Up @@ -245,9 +238,9 @@
},
);

const handleChangeIncludeRule = async () => {
await formRef.value.validate();
formData.number_of_types = Math.min(formData.number_of_types, typeMaxCount.value);
const handleChangeIncludeRule = () => {
formData.number_of_types = typeMaxCount.value;
formRef.value.validate();
};

const handleInputChange = (value: string) => {
Expand Down

0 comments on commit 0617ca9

Please sign in to comment.