소스 검색

New feature: Forgot password (prerequisite in the very standard authent local module)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2859 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 년 전
부모
커밋
2ec57ded58
1개의 변경된 파일15개의 추가작업 그리고 9개의 파일을 삭제
  1. 15 9
      datamodels/2.x/authent-local/model.authent-local.php

+ 15 - 9
datamodels/2.x/authent-local/model.authent-local.php

@@ -85,18 +85,24 @@ class UserLocal extends UserInternal
 		// Let's ask the password to compare the hashed values
 		if ($oPassword->CheckPassword($sOldPassword))
 		{
-			$this->Set('password', $sNewPassword);
-			$oChange = MetaModel::NewObject("CMDBChange");
-			$oChange->Set("date", time());
-			$sUserString = CMDBChange::GetCurrentUserName();
-			$oChange->Set("userinfo", $sUserString);
-			$oChange->DBInsert();
-			$this->DBUpdateTracked($oChange, true);
+			$this->SetPassword($sNewPassword);
 			return true;
 		}
 		return false;
 	}
-}
 
+	/**
+	 * Use with care!
+	 */	 	
+	public function SetPassword($sNewPassword)
+	{
+		$this->Set('password', $sNewPassword);
+		$oChange = MetaModel::NewObject("CMDBChange");
+		$oChange->Set("date", time());
+		$sUserString = CMDBChange::GetCurrentUserName();
+		$oChange->Set("userinfo", $sUserString);
+		$oChange->DBInsert();
+		$this->DBUpdateTracked($oChange, true);
+	}
+}
 
-?>