public function AjaxHelpdeskForgotChangePassword() { $sTenantHash = trim($this->getParamValue('TenantHash', '')); if ($this->oApiCapability->IsHelpdeskSupported()) { $sActivateHash = \trim($this->getParamValue('ActivateHash', '')); $sNewPassword = \trim($this->getParamValue('NewPassword', '')); if (0 === strlen($sNewPassword) || 0 === strlen($sActivateHash)) { throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::InvalidInputParameter); } $mIdTenant = $this->oApiIntegrator->GetTenantIdByHash($sTenantHash); if (!is_int($mIdTenant)) { throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::InvalidInputParameter); } $oHelpdesk = $this->ApiHelpdesk(); if ($oHelpdesk) { $oUser = $oHelpdesk->GetUserByActivateHash($mIdTenant, $sActivateHash); if (!$oUser instanceof \CHelpdeskUser) { throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::HelpdeskUnknownUser); } $oUser->Activated = true; $oUser->SetPassword($sNewPassword); $oUser->RegenerateActivateHash(); return $this->DefaultResponse(null, __FUNCTION__, $oHelpdesk->UpdateUser($oUser)); } } return $this->FalseResponse(null, __FUNCTION__); }