Skip to content
Snippets Groups Projects
Commit ae7e35c1 authored by Patrick Broens's avatar Patrick Broens Committed by Wouter Wolters
Browse files

[BUGFIX] Form email validation is case sensitive

Currently the FORM email validation is using a regular expression which
checks the email address. This check also inclused case sensitivity.

This patch fixes this by using the email address validator which comes
with the extension core.

Change-Id: Ib1449198f66f023a01c9791e74eb2d634abd77df
Resolves: #43924
Releases: 6.0, 6.1, 6.2
Reviewed-on: https://review.typo3.org/20421
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
parent bc3a855a
Branches
Tags
No related merge requests found
......@@ -40,7 +40,7 @@ class EmailValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator {
public function isValid() {
if ($this->requestHandler->has($this->fieldName)) {
$value = $this->requestHandler->getByMethod($this->fieldName);
if (!preg_match('/^(?:(?#local-part)(?#quoted)"[^\\"]*"|(?#non-quoted)[a-z0-9&+_-](?:\\.?[a-z0-9&+_-]+)*)@(?:(?#domain)(?#domain-name)[a-z0-9](?:[a-z0-9-]*[a-z0-9])*(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])*)*|(?#ip)(\\[)?(?:[01]?\\d?\\d|2[0-4]\\d|25[0-5])(?:\\.(?:[01]?\\d?\\d|2[0-4]\\d|25[0-5])){3}(?(1)\\]|))$/', $value)) {
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($value)) {
return FALSE;
}
}
......
......@@ -25,11 +25,12 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
***************************************************************/
/**
* Test case for class \TYPO3\CMS\Form\Validation\EmailValidator.
* Test case
*
* @author Andreas Lappe <a.lappe@kuehlhaus.com>
*/
class EmailValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/**
* @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
*/
......@@ -51,16 +52,16 @@ class EmailValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
public function validEmailProvider() {
return array(
'a@b.de' => array('a@b.de'),
'somebody@localhost' => array('somebody@localhost'),
'a@b.de' => array('a@b.de'),
'somebody@mymac.local' => array('somebody@mymac.local')
);
}
public function invalidEmailProvider() {
return array(
'myemail@' => array('myemail@'),
'myemail' => array('myemail'),
'myemail@' => array('myemail@'),
'myemail' => array('myemail'),
'somebody@localhost' => array('somebody@localhost'),
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment