浏览代码

#988 Could not change the case of a login

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3338 a333f486-631f-4898-b8df-5754b55c2be0
romainq 10 年之前
父节点
当前提交
391a41ed5d
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      core/userrights.class.inc.php

+ 8 - 5
core/userrights.class.inc.php

@@ -234,12 +234,15 @@ abstract class User extends cmdbAbstractObject
 		$aChanges = $this->ListChanges();
 		if (array_key_exists('login', $aChanges))
 		{
-			$sNewLogin = $aChanges['login'];
-			$oSearch = DBObjectSearch::FromOQL_AllData("SELECT User WHERE login = :newlogin");
-			$oSet = new DBObjectSet($oSearch, array(), array('newlogin' => $sNewLogin));
-			if ($oSet->Count() > 0)
+			if (strcasecmp($this->Get('login'), $this->GetOriginal('login')) !== 0)
 			{
-				$this->m_aCheckIssues[] = Dict::Format('Class:User/Error:LoginMustBeUnique', $sNewLogin);
+				$sNewLogin = $aChanges['login'];
+				$oSearch = DBObjectSearch::FromOQL_AllData("SELECT User WHERE login = :newlogin");
+				$oSet = new DBObjectSet($oSearch, array(), array('newlogin' => $sNewLogin));
+				if ($oSet->Count() > 0)
+				{
+					$this->m_aCheckIssues[] = Dict::Format('Class:User/Error:LoginMustBeUnique', $sNewLogin);
+				}
 			}
 		}
 		// Check that this user has at least one profile assigned