diff --git a/dev/Styles/MessageView.less b/dev/Styles/MessageView.less index e3739d5ad..3069910c1 100644 --- a/dev/Styles/MessageView.less +++ b/dev/Styles/MessageView.less @@ -1,4 +1,3 @@ -showImages html.rl-no-preview-pane { .messageView { diff --git a/dev/ViewModels/PopupsComposeViewModel.js b/dev/ViewModels/PopupsComposeViewModel.js index 14647c8a0..71dfff965 100644 --- a/dev/ViewModels/PopupsComposeViewModel.js +++ b/dev/ViewModels/PopupsComposeViewModel.js @@ -579,7 +579,7 @@ PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom) sSignature = sSignature.replace(/{{IF:FROM}}[\s\S]+{{\/IF:FROM}}/gm, ''); } - sSignature = Utils.trim(sSignature.replace(/{{FROM}}/, '').replace(/{{IF:FROM}}/, '').replace(/{{\/IF:FROM}}/, '')); + sSignature = "\r\n" + Utils.trim(sSignature.replace(/{{FROM}}/, '').replace(/{{IF:FROM}}/, '').replace(/{{\/IF:FROM}}/, '')); } return sSignature; diff --git a/plugins/recaptcha/index.php b/plugins/recaptcha/index.php index 2d7b456fe..2875839f7 100644 --- a/plugins/recaptcha/index.php +++ b/plugins/recaptcha/index.php @@ -1,140 +1,139 @@ -UseLangs(true); - - $this->addJs('js/recaptcha.js'); - - $this->addHook('ajax.action-pre-call', 'AjaxActionPreCall'); - $this->addHook('filter.ajax-response', 'FilterAjaxResponse'); - - $this->addTemplate('templates/PluginLoginReCaptchaGroup.html'); - $this->addTemplateHook('Login', 'BottomControlGroup', 'PluginLoginReCaptchaGroup'); - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('public_key')->SetLabel('Public Key') - ->SetAllowedInJs(true) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('private_key')->SetLabel('Private Key') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('error_limit')->SetLabel('Limit') - ->SetDefaultValue(0) - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array(0, 1, 2, 3, 4, 5)) - ->SetDescription('') - ); - } - - /** - * @return string - */ - private function getCaptchaCacherKey() - { - return 'Captcha/Login/'.\RainLoop\Utils::GetConnectionToken(); - } - - /** - * @return int - */ - private function getLimit() - { - $iConfigLimit = $this->Config()->Get('plugin', 'error_limit', 0); - if (0 < $iConfigLimit) - { - $oCacher = $this->Manager()->Actions()->Cacher(); - $sLimit = $oCacher && $oCacher->IsInited() ? $oCacher->Get($this->getCaptchaCacherKey()) : '0'; - - if (0 < strlen($sLimit) && is_numeric($sLimit)) - { - $iConfigLimit -= (int) $sLimit; - } - } - - return $iConfigLimit; - } - - /** - * @return void - */ - public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aData) - { - if (!$bAdmin && !$bAuth && is_array($aData)) - { - $aData['show_captcha_on_login'] = 1 > $this->getLimit(); - } - } - - /** - * @param string $sAction - */ - public function AjaxActionPreCall($sAction) - { - if ('Login' === $sAction && 0 >= $this->getLimit()) - { - require_once __DIR__.'/recaptchalib.php'; - - $oResp = recaptcha_check_answer( - $this->Config()->Get('plugin', 'private_key', ''), - isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', - $this->Manager()->Actions()->GetActionParam('RecaptchaChallenge', ''), - $this->Manager()->Actions()->GetActionParam('RecaptchaResponse', '') - ); - - if (!$oResp || !isset($oResp->is_valid) || !$oResp->is_valid) - { - $this->Manager()->Actions()->Logger()->WriteDump($oResp); - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CaptchaError); - } - } - } - - /** - * @param string $sAction - * @param array $aResponseItem - */ - public function FilterAjaxResponse($sAction, &$aResponseItem) - { - if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result'])) - { - $oCacher = $this->Manager()->Actions()->Cacher(); - $iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0); - $sKey = $this->getCaptchaCacherKey(); - - if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited()) - { - if (false === $aResponseItem['Result']) - { - $iLimit = 0; - $sLimut = $oCacher->Get($sKey); - if (0 < strlen($sLimut) && is_numeric($sLimut)) - { - $iLimit = (int) $sLimut; - } - - $oCacher->Set($sKey, ++$iLimit); - - if ($iConfigLimit <= $iLimit) - { - $aResponseItem['Captcha'] = true; - } - } - else - { - $oCacher->Delete($sKey); - } - } - } - } -} +UseLangs(true); + + $this->addJs('js/recaptcha.js'); + + $this->addHook('ajax.action-pre-call', 'AjaxActionPreCall'); + $this->addHook('filter.ajax-response', 'FilterAjaxResponse'); + + $this->addTemplate('templates/PluginLoginReCaptchaGroup.html'); + $this->addTemplateHook('Login', 'BottomControlGroup', 'PluginLoginReCaptchaGroup'); + } + + /** + * @return array + */ + public function configMapping() + { + return array( + \RainLoop\Plugins\Property::NewInstance('public_key')->SetLabel('Public Key') + ->SetAllowedInJs(true) + ->SetDefaultValue(''), + \RainLoop\Plugins\Property::NewInstance('private_key')->SetLabel('Private Key') + ->SetDefaultValue(''), + \RainLoop\Plugins\Property::NewInstance('error_limit')->SetLabel('Limit') + ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) + ->SetDefaultValue(array(0, 1, 2, 3, 4, 5)) + ->SetDescription('') + ); + } + + /** + * @return string + */ + private function getCaptchaCacherKey() + { + return 'Captcha/Login/'.\RainLoop\Utils::GetConnectionToken(); + } + + /** + * @return int + */ + private function getLimit() + { + $iConfigLimit = $this->Config()->Get('plugin', 'error_limit', 0); + if (0 < $iConfigLimit) + { + $oCacher = $this->Manager()->Actions()->Cacher(); + $sLimit = $oCacher && $oCacher->IsInited() ? $oCacher->Get($this->getCaptchaCacherKey()) : '0'; + + if (0 < strlen($sLimit) && is_numeric($sLimit)) + { + $iConfigLimit -= (int) $sLimit; + } + } + + return $iConfigLimit; + } + + /** + * @return void + */ + public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aData) + { + if (!$bAdmin && !$bAuth && is_array($aData)) + { + $aData['show_captcha_on_login'] = 1 > $this->getLimit(); + } + } + + /** + * @param string $sAction + */ + public function AjaxActionPreCall($sAction) + { + if ('Login' === $sAction && 0 >= $this->getLimit()) + { + require_once __DIR__.'/recaptchalib.php'; + + $oResp = recaptcha_check_answer( + $this->Config()->Get('plugin', 'private_key', ''), + isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', + $this->Manager()->Actions()->GetActionParam('RecaptchaChallenge', ''), + $this->Manager()->Actions()->GetActionParam('RecaptchaResponse', '') + ); + + if (!$oResp || !isset($oResp->is_valid) || !$oResp->is_valid) + { + $this->Manager()->Actions()->Logger()->WriteDump($oResp); + throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CaptchaError); + } + } + } + + /** + * @param string $sAction + * @param array $aResponseItem + */ + public function FilterAjaxResponse($sAction, &$aResponseItem) + { + if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result'])) + { + $oCacher = $this->Manager()->Actions()->Cacher(); + $iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0); + $sKey = $this->getCaptchaCacherKey(); + + if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited()) + { + if (false === $aResponseItem['Result']) + { + $iLimit = 0; + $sLimut = $oCacher->Get($sKey); + if (0 < strlen($sLimut) && is_numeric($sLimut)) + { + $iLimit = (int) $sLimut; + } + + $oCacher->Set($sKey, ++$iLimit); + + if ($iConfigLimit <= $iLimit) + { + $aResponseItem['Captcha'] = true; + } + } + else + { + $oCacher->Delete($sKey); + } + } + } + } +} diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 08dcec178..8ec7c1a1b 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -4073,7 +4073,7 @@ class Actions if (!$bAddHiddenRcpt) { - $aSmtpCredentials[] = array(); + $aSmtpCredentials['HiddenRcpt'] = array(); } $bHookConnect = $bHookAuth = $bHookFrom = $bHookFrom = $bHookTo = $bHookData = $bHookLogoutAndDisconnect = false; diff --git a/rainloop/v/0.0.0/app/templates/Views/PopupsContacts.html b/rainloop/v/0.0.0/app/templates/Views/PopupsContacts.html index d4cc5e680..b6e1b8916 100644 --- a/rainloop/v/0.0.0/app/templates/Views/PopupsContacts.html +++ b/rainloop/v/0.0.0/app/templates/Views/PopupsContacts.html @@ -43,32 +43,8 @@