Skip to content

Commit ec18f90

Browse files
committed
fix:- Regex on password field
1 parent 40a8975 commit ec18f90

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy