Repository: struts
Updated Branches:
  refs/heads/master 7a06fe47e -> c3ec2c339


Email validation blocks upper case letters

Fix makes email validation regex case insensitive.


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/907ce980
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/907ce980
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/907ce980

Branch: refs/heads/master
Commit: 907ce9802e43f63c2c548aa1f1ee6f41c980daa0
Parents: afb0c2a
Author: Lukasz Racon <[email protected]>
Authored: Mon Nov 9 14:14:07 2015 -0600
Committer: Lukasz Racon <[email protected]>
Committed: Mon Nov 9 14:14:07 2015 -0600

----------------------------------------------------------------------
 core/src/main/resources/template/xhtml/form-close-validate.ftl     | 2 +-
 .../java/com/opensymphony/xwork2/validator/EmailValidatorTest.java | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/907ce980/core/src/main/resources/template/xhtml/form-close-validate.ftl
----------------------------------------------------------------------
diff --git a/core/src/main/resources/template/xhtml/form-close-validate.ftl 
b/core/src/main/resources/template/xhtml/form-close-validate.ftl
index f129156..1c8c629 100644
--- a/core/src/main/resources/template/xhtml/form-close-validate.ftl
+++ b/core/src/main/resources/template/xhtml/form-close-validate.ftl
@@ -114,7 +114,7 @@ END SNIPPET: supported-validators
                 <#if validator.shortCircuit>continueValidation = false;</#if>
             }
             <#elseif validator.validatorType = "email">
-            if (continueValidation && fieldValue != null && fieldValue.length 
> 0 && fieldValue.match("${validator.regex?js_string}")==null) {
+            if (continueValidation && fieldValue != null && fieldValue.length 
> 0 && fieldValue.match(new RegExp("${validator.regex?js_string}", "i"))==null) 
{
                 addError(field, error);
                 errors = true;
                 <#if validator.shortCircuit>continueValidation = false;</#if>

http://git-wip-us.apache.org/repos/asf/struts/blob/907ce980/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java 
b/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
index ca9a549..d24d795 100644
--- 
a/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
+++ 
b/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
@@ -30,6 +30,7 @@ import 
com.opensymphony.xwork2.validator.validators.EmailValidator;
 public class EmailValidatorTest extends XWorkTestCase {
 
     public void testEmailValidity() throws Exception {
+        assertTrue(verifyEmailValidity("[email protected]"));
         assertTrue(verifyEmailValidity("[email protected]"));
         assertTrue(verifyEmailValidityWithExpression("[email protected]", 
"\\b^[a-z]+@[a-z]+(\\.[a-z]+)*\\.com$\\b"));
         assertTrue(verifyEmailValidity("[email protected]"));

Reply via email to