mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
Email validation blocks upper case letters
Fix makes email validation regex case insensitive.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.opensymphony.xwork2.validator.validators.EmailValidator;
|
||||
public class EmailValidatorTest extends XWorkTestCase {
|
||||
|
||||
public void testEmailValidity() throws Exception {
|
||||
assertTrue(verifyEmailValidity("TmJee@Yahoo.com"));
|
||||
assertTrue(verifyEmailValidity("tmjee@yahoo.com"));
|
||||
assertTrue(verifyEmailValidityWithExpression("tmjee@yahoo.com", "\\b^[a-z]+@[a-z]+(\\.[a-z]+)*\\.com$\\b"));
|
||||
assertTrue(verifyEmailValidity("tm_jee@yahoo.co"));
|
||||
|
||||
Reference in New Issue
Block a user