Skip to content

Commit 8346db5

Browse files
Merge pull request #1890 from kamalqureshi/password_regex
Error message on password field
2 parents 701d57c + ec18f90 commit 8346db5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,16 @@ test("textInputValidate", () => {
7979
validateStatus: "error",
8080
help: trans("validationDesc.maxLength", { length: 4, maxLength: 2 }),
8181
});
82+
83+
expect(
84+
textInputValidate({
85+
value: { value: "" },
86+
required: false,
87+
minLength: 0,
88+
maxLength: 0,
89+
validationType: "Regex",
90+
regex: new RegExp("^.*$"),
91+
customRule: "",
92+
})
93+
).toMatchObject({ validateStatus: "" });
8294
});

client/packages/lowcoder/src/comps/controls/codeControl.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ function toRegExp(value: unknown): RegExp {
281281
return value as RegExp;
282282
} else if (valueType === "string") {
283283
const regexStr = trimStart(value as string, "^");
284-
return new RegExp("^" + (regexStr ?? ".*") + "$");
284+
const finalRegexStr = regexStr || ".*";
285+
return new RegExp("^" + finalRegexStr + "$");
285286
}
286287
throw new TypeError(
287288
`must be a valid JavaScript regular expression without forward slashes around the pattern`

0 commit comments

Comments
 (0)