From 7e6be98b9f73b748fda8352e64134e81952dea66 Mon Sep 17 00:00:00 2001 From: pebosi Date: Fri, 5 Apr 2013 08:45:23 +0200 Subject: [PATCH 1/4] Add apostroph as allowed character to local email part --- core/Piwik.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Piwik.php b/core/Piwik.php index 2f4f75b1dab..55636e00e28 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -2037,7 +2037,7 @@ static public function createAccessObject() */ static public function isValidEmailString($email) { - return (preg_match('/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9_.-]+\.[a-zA-Z]{2,7}$/D', $email) > 0); + return (preg_match("/^[a-zA-Z0-9_.+-']+@[a-zA-Z0-9_.-]+\.[a-zA-Z]{2,7}$/D", $email) > 0); } /** From 755f332d8dd7edfa61792bd51a103f27a9b720d9 Mon Sep 17 00:00:00 2001 From: pebosi Date: Fri, 5 Apr 2013 09:58:43 +0200 Subject: [PATCH 2/4] Fix regexp --- core/Piwik.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Piwik.php b/core/Piwik.php index 55636e00e28..171a8fa7e2f 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -2037,7 +2037,7 @@ static public function createAccessObject() */ static public function isValidEmailString($email) { - return (preg_match("/^[a-zA-Z0-9_.+-']+@[a-zA-Z0-9_.-]+\.[a-zA-Z]{2,7}$/D", $email) > 0); + return (preg_match("/^[a-zA-Z0-9_.+'-]+@[a-zA-Z0-9_.-]+\.[a-zA-Z]{2,7}$/D", $email) > 0); } /** From c144eb6934c29ed9ceb35af0d1c8d53883eacf01 Mon Sep 17 00:00:00 2001 From: pebosi Date: Fri, 5 Apr 2013 11:11:34 +0200 Subject: [PATCH 3/4] fix test to allow apostroph --- tests/PHPUnit/Plugins/UsersManagerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PHPUnit/Plugins/UsersManagerTest.php b/tests/PHPUnit/Plugins/UsersManagerTest.php index 4b8bc9b0e86..b5c61a1e9f2 100644 --- a/tests/PHPUnit/Plugins/UsersManagerTest.php +++ b/tests/PHPUnit/Plugins/UsersManagerTest.php @@ -225,7 +225,7 @@ public function testAddUserWrongPassword($userLogin, $password, $email, $alias) public function getWrongEmailTestData() { return array( - array("geggeqgeqag", "geqgeagae", "ema'il@email.com", "alias"), + array("geggeqgeqag", "geqgeagae", "alias"), array("geggeqgeqag", "geqgeagae", "@email.com", "alias"), array("geggeqgeqag", "geqgeagae", "email@.com", "alias"), array("geggeqgeqag", "geqgeagae", "email@4.", "alias"), From e71153c28e05628e9c676d377451ae4fb7c0ef49 Mon Sep 17 00:00:00 2001 From: pebosi Date: Fri, 5 Apr 2013 11:13:58 +0200 Subject: [PATCH 4/4] fix test --- tests/PHPUnit/Plugins/UsersManagerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/PHPUnit/Plugins/UsersManagerTest.php b/tests/PHPUnit/Plugins/UsersManagerTest.php index b5c61a1e9f2..6f8f417791d 100644 --- a/tests/PHPUnit/Plugins/UsersManagerTest.php +++ b/tests/PHPUnit/Plugins/UsersManagerTest.php @@ -225,7 +225,6 @@ public function testAddUserWrongPassword($userLogin, $password, $email, $alias) public function getWrongEmailTestData() { return array( - array("geggeqgeqag", "geqgeagae", "alias"), array("geggeqgeqag", "geqgeagae", "@email.com", "alias"), array("geggeqgeqag", "geqgeagae", "email@.com", "alias"), array("geggeqgeqag", "geqgeagae", "email@4.", "alias"),