Beispiel #1
0
 /**
  * @param string $sLogin
  *
  * @return CAccount
  */
 private function &getAccount($sLogin)
 {
     $mResult = null;
     if (!isset($this->aAccounts[$sLogin])) {
         $this->aAccounts[$sLogin] = $this->oApiUsersManager->GetAccountOnLogin($sLogin);
     }
     $mResult =& $this->aAccounts[$sLogin];
     if (30 < count($this->aAccounts[$sLogin])) {
         $this->aAccounts = array_slice($this->aAccounts, -30);
     }
     return $mResult;
 }
Beispiel #2
0
	/**
	 * @return array
	 */
	public function AjaxChangeForgotAccountPassword()
	{
		$sEmail = trim((string) $this->getParamValue('Email', ''));
		$sQuestion =  trim((string) $this->getParamValue('Question', ''));
		$sAnswer =  trim((string) $this->getParamValue('Answer', ''));
		$sPassword =  trim((string) $this->getParamValue('Password', ''));

		$oSettings =& \CApi::GetSettings();
		if (!$oSettings || !$oSettings->GetConf('Common/AllowPasswordReset') ||
			0 === strlen($sEmail) || 0 === strlen($sAnswer) || 0 === strlen($sQuestion) || 0 === strlen($sPassword))
		{
			throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::InvalidInputParameter);
		}

		$oAccount = $this->oApiUsers->GetAccountOnLogin($sEmail);
		if (!($oAccount instanceof \CAccount) || !$oAccount->IsInternal ||
			$oAccount->User->Question1 !== $sQuestion || $oAccount->User->Answer1 !== $sAnswer)
		{
			throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::InvalidInputParameter); // TODO
		}

		$oAccount->PreviousMailPassword = $oAccount->IncomingMailPassword;
		$oAccount->IncomingMailPassword = $sPassword;

		return $this->DefaultResponse($oAccount, __FUNCTION__, $this->oApiUsers->UpdateAccount($oAccount));
	}