[evolvis-commits] r13415: Fixed checking of email unicity when changing email addresses, patch by Julien Heyman

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 02:35:27 CET 2011


Author: mirabilos
Date: 2011-02-28 02:35:27 +0100 (Mon, 28 Feb 2011)
New Revision: 13415

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/common/include/User.class.php
Log:
Fixed checking of email unicity when changing email addresses, patch by Julien Heyman

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/common/include/User.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/include/User.class.php	2011-02-28 01:35:25 UTC (rev 13414)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/include/User.class.php	2011-02-28 01:35:27 UTC (rev 13415)
@@ -834,8 +834,8 @@
 		}
 
 		if ($GLOBALS['sys_require_unique_email']) {
-			if (db_numrows(db_query_params('SELECT user_id FROM users WHERE email ILIKE $1 OR email_new ILIKE $2',
-						       array ($email, $email))) > 0) {
+			if (db_numrows(db_query_params('SELECT user_id FROM users WHERE user_id!=$1 AND (email ILIKE $2 OR email_new ILIKE $2)',
+						       array ($this->getID(), $email))) > 0) {
 				$this->setError(_('User with this email already exists.'));
 			return false;
 			}
@@ -886,8 +886,8 @@
 		}
 
 		if ($GLOBALS['sys_require_unique_email']) {
-			if (db_numrows(db_query_params ('SELECT user_id FROM users WHERE email ILIKE $1 OR email_new ILIKE $1',
-							array ($email))) > 0) {
+			if (db_numrows(db_query_params('SELECT user_id FROM users WHERE user_id!=$1 AND (email ILIKE $2 OR email_new ILIKE $2)',
+						       array ($this->getID(), $email))) > 0) {
 				$this->setError(_('User with this email already exists.'));
 			return false;
 			}



More information about the evolvis-commits mailing list