File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ if (typeof brutusin === "undefined") {
76
76
"exclusiveMaximum" : "Value must be **lower than** `{0}`" ,
77
77
"minProperties" : "At least `{0}` properties are required" ,
78
78
"maxProperties" : "At most `{0}` properties are allowed" ,
79
+ "email" : "The email must at least consists an asterisk (@), following by a domain name with a dot (.)" ,
79
80
"uniqueItems" : "Array items must be unique" ,
80
81
"addItem" : "Add item" ,
81
82
"true" : "True" ,
@@ -277,6 +278,13 @@ if (typeof brutusin === "undefined") {
277
278
return BrutusinForms . messages [ "maxLength" ] . format ( s . maxLength ) ;
278
279
}
279
280
}
281
+ //Add a default regex pattern matching for email validation, or else user could use
282
+ //the `pattern` field for their own custom regex pattern
283
+ if ( ! s . pattern && s . format === "email" ) {
284
+ if ( ! value . match ( / [ ^ @ \s ] + @ [ ^ @ \s ] + \. [ ^ @ \s ] + / ) ) {
285
+ return BrutusinForms . messages [ "email" ] ;
286
+ }
287
+ }
280
288
}
281
289
if ( value !== null && ! isNaN ( value ) ) {
282
290
if ( s . multipleOf && value % s . multipleOf !== 0 ) {
You can’t perform that action at this time.
0 commit comments