Merge pull request #2109 from dominikschulz/fix/rest

Fix RestChangePasswordDriver
This commit is contained in:
RainLoop Team 2022-09-01 00:01:11 +03:00 committed by GitHub
commit 9bf8fa5b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -38,8 +38,8 @@ class RestChangePasswordDriver implements \RainLoop\Providers\ChangePassword\Cha
private $oLogger = null;
/**
* @param string $sHost
* @param int $iPort
* @param string $sUrl
* @param string $sKey
*
* @return \RestChangePasswordDriver
*/
@ -51,8 +51,6 @@ class RestChangePasswordDriver implements \RainLoop\Providers\ChangePassword\Cha
return $this;
}
$oProvider->SetFieldNames($sFieldEmail, $sFieldOldpassword, $sFieldNewpassword);
/**
* @param string $sFieldEmail
* @param string $sFieldOldpassword
@ -120,12 +118,16 @@ class RestChangePasswordDriver implements \RainLoop\Providers\ChangePassword\Cha
}
$bResult = false;
if (!empty($this->sHost) && 0 < $this->iPort && $oAccount)
if (!empty($this->sUrl) && $oAccount)
{
$sEmail = \trim(\strtolower($oAccount->Email()));
$sUrl = $this->sUrl;
# Adding the REST Api key to the url, try to use always https
$sUrl = str_replace('://', '://'+$this->sKey+"@", $this->sUrl);
if (!empty($this->sKey))
{
$sUrl = str_replace('://', '://'+$this->sKey+"@", $this->sUrl);
}
$iCode = 0;
$oHttp = \MailSo\Base\Http::SingletonInstance();

View file

@ -24,7 +24,7 @@ class RestChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
$sFieldOldpassword = \trim($this->Config()->Get('plugin', 'rest_field_oldpassword', ''));
$sFieldNewpassword = \trim($this->Config()->Get('plugin', 'rest_field_newpassword', ''));
if (!empty($sHost) && (!empty($sKey)))
if (!empty($sUrl))
{
include_once __DIR__.'/RestChangePasswordDriver.php';