mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Small fixes (fixed #61)
This commit is contained in:
parent
ae2e2ea61e
commit
3a5d5038b9
9 changed files with 147 additions and 173 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
showImages
|
|
||||||
html.rl-no-preview-pane {
|
html.rl-no-preview-pane {
|
||||||
|
|
||||||
.messageView {
|
.messageView {
|
||||||
|
|
|
||||||
|
|
@ -579,7 +579,7 @@ PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom)
|
||||||
sSignature = sSignature.replace(/{{IF:FROM}}[\s\S]+{{\/IF:FROM}}/gm, '');
|
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;
|
return sSignature;
|
||||||
|
|
|
||||||
|
|
@ -1,140 +1,139 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class RecaptchaPlugin extends \RainLoop\Plugins\AbstractPlugin
|
class RecaptchaPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function Init()
|
public function Init()
|
||||||
{
|
{
|
||||||
$this->UseLangs(true);
|
$this->UseLangs(true);
|
||||||
|
|
||||||
$this->addJs('js/recaptcha.js');
|
$this->addJs('js/recaptcha.js');
|
||||||
|
|
||||||
$this->addHook('ajax.action-pre-call', 'AjaxActionPreCall');
|
$this->addHook('ajax.action-pre-call', 'AjaxActionPreCall');
|
||||||
$this->addHook('filter.ajax-response', 'FilterAjaxResponse');
|
$this->addHook('filter.ajax-response', 'FilterAjaxResponse');
|
||||||
|
|
||||||
$this->addTemplate('templates/PluginLoginReCaptchaGroup.html');
|
$this->addTemplate('templates/PluginLoginReCaptchaGroup.html');
|
||||||
$this->addTemplateHook('Login', 'BottomControlGroup', 'PluginLoginReCaptchaGroup');
|
$this->addTemplateHook('Login', 'BottomControlGroup', 'PluginLoginReCaptchaGroup');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function configMapping()
|
public function configMapping()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
\RainLoop\Plugins\Property::NewInstance('public_key')->SetLabel('Public Key')
|
\RainLoop\Plugins\Property::NewInstance('public_key')->SetLabel('Public Key')
|
||||||
->SetAllowedInJs(true)
|
->SetAllowedInJs(true)
|
||||||
->SetDefaultValue(''),
|
->SetDefaultValue(''),
|
||||||
\RainLoop\Plugins\Property::NewInstance('private_key')->SetLabel('Private Key')
|
\RainLoop\Plugins\Property::NewInstance('private_key')->SetLabel('Private Key')
|
||||||
->SetDefaultValue(''),
|
->SetDefaultValue(''),
|
||||||
\RainLoop\Plugins\Property::NewInstance('error_limit')->SetLabel('Limit')
|
\RainLoop\Plugins\Property::NewInstance('error_limit')->SetLabel('Limit')
|
||||||
->SetDefaultValue(0)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION)
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION)
|
->SetDefaultValue(array(0, 1, 2, 3, 4, 5))
|
||||||
->SetDefaultValue(array(0, 1, 2, 3, 4, 5))
|
->SetDescription('')
|
||||||
->SetDescription('')
|
);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return string
|
||||||
* @return string
|
*/
|
||||||
*/
|
private function getCaptchaCacherKey()
|
||||||
private function getCaptchaCacherKey()
|
{
|
||||||
{
|
return 'Captcha/Login/'.\RainLoop\Utils::GetConnectionToken();
|
||||||
return 'Captcha/Login/'.\RainLoop\Utils::GetConnectionToken();
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return int
|
||||||
* @return int
|
*/
|
||||||
*/
|
private function getLimit()
|
||||||
private function getLimit()
|
{
|
||||||
{
|
$iConfigLimit = $this->Config()->Get('plugin', 'error_limit', 0);
|
||||||
$iConfigLimit = $this->Config()->Get('plugin', 'error_limit', 0);
|
if (0 < $iConfigLimit)
|
||||||
if (0 < $iConfigLimit)
|
{
|
||||||
{
|
$oCacher = $this->Manager()->Actions()->Cacher();
|
||||||
$oCacher = $this->Manager()->Actions()->Cacher();
|
$sLimit = $oCacher && $oCacher->IsInited() ? $oCacher->Get($this->getCaptchaCacherKey()) : '0';
|
||||||
$sLimit = $oCacher && $oCacher->IsInited() ? $oCacher->Get($this->getCaptchaCacherKey()) : '0';
|
|
||||||
|
if (0 < strlen($sLimit) && is_numeric($sLimit))
|
||||||
if (0 < strlen($sLimit) && is_numeric($sLimit))
|
{
|
||||||
{
|
$iConfigLimit -= (int) $sLimit;
|
||||||
$iConfigLimit -= (int) $sLimit;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return $iConfigLimit;
|
||||||
return $iConfigLimit;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return void
|
||||||
* @return void
|
*/
|
||||||
*/
|
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aData)
|
||||||
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aData)
|
{
|
||||||
{
|
if (!$bAdmin && !$bAuth && is_array($aData))
|
||||||
if (!$bAdmin && !$bAuth && is_array($aData))
|
{
|
||||||
{
|
$aData['show_captcha_on_login'] = 1 > $this->getLimit();
|
||||||
$aData['show_captcha_on_login'] = 1 > $this->getLimit();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @param string $sAction
|
||||||
* @param string $sAction
|
*/
|
||||||
*/
|
public function AjaxActionPreCall($sAction)
|
||||||
public function AjaxActionPreCall($sAction)
|
{
|
||||||
{
|
if ('Login' === $sAction && 0 >= $this->getLimit())
|
||||||
if ('Login' === $sAction && 0 >= $this->getLimit())
|
{
|
||||||
{
|
require_once __DIR__.'/recaptchalib.php';
|
||||||
require_once __DIR__.'/recaptchalib.php';
|
|
||||||
|
$oResp = recaptcha_check_answer(
|
||||||
$oResp = recaptcha_check_answer(
|
$this->Config()->Get('plugin', 'private_key', ''),
|
||||||
$this->Config()->Get('plugin', 'private_key', ''),
|
isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '',
|
||||||
isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '',
|
$this->Manager()->Actions()->GetActionParam('RecaptchaChallenge', ''),
|
||||||
$this->Manager()->Actions()->GetActionParam('RecaptchaChallenge', ''),
|
$this->Manager()->Actions()->GetActionParam('RecaptchaResponse', '')
|
||||||
$this->Manager()->Actions()->GetActionParam('RecaptchaResponse', '')
|
);
|
||||||
);
|
|
||||||
|
if (!$oResp || !isset($oResp->is_valid) || !$oResp->is_valid)
|
||||||
if (!$oResp || !isset($oResp->is_valid) || !$oResp->is_valid)
|
{
|
||||||
{
|
$this->Manager()->Actions()->Logger()->WriteDump($oResp);
|
||||||
$this->Manager()->Actions()->Logger()->WriteDump($oResp);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CaptchaError);
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CaptchaError);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @param string $sAction
|
||||||
* @param string $sAction
|
* @param array $aResponseItem
|
||||||
* @param array $aResponseItem
|
*/
|
||||||
*/
|
public function FilterAjaxResponse($sAction, &$aResponseItem)
|
||||||
public function FilterAjaxResponse($sAction, &$aResponseItem)
|
{
|
||||||
{
|
if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result']))
|
||||||
if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result']))
|
{
|
||||||
{
|
$oCacher = $this->Manager()->Actions()->Cacher();
|
||||||
$oCacher = $this->Manager()->Actions()->Cacher();
|
$iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0);
|
||||||
$iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0);
|
$sKey = $this->getCaptchaCacherKey();
|
||||||
$sKey = $this->getCaptchaCacherKey();
|
|
||||||
|
if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited())
|
||||||
if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited())
|
{
|
||||||
{
|
if (false === $aResponseItem['Result'])
|
||||||
if (false === $aResponseItem['Result'])
|
{
|
||||||
{
|
$iLimit = 0;
|
||||||
$iLimit = 0;
|
$sLimut = $oCacher->Get($sKey);
|
||||||
$sLimut = $oCacher->Get($sKey);
|
if (0 < strlen($sLimut) && is_numeric($sLimut))
|
||||||
if (0 < strlen($sLimut) && is_numeric($sLimut))
|
{
|
||||||
{
|
$iLimit = (int) $sLimut;
|
||||||
$iLimit = (int) $sLimut;
|
}
|
||||||
}
|
|
||||||
|
$oCacher->Set($sKey, ++$iLimit);
|
||||||
$oCacher->Set($sKey, ++$iLimit);
|
|
||||||
|
if ($iConfigLimit <= $iLimit)
|
||||||
if ($iConfigLimit <= $iLimit)
|
{
|
||||||
{
|
$aResponseItem['Captcha'] = true;
|
||||||
$aResponseItem['Captcha'] = true;
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
$oCacher->Delete($sKey);
|
||||||
$oCacher->Delete($sKey);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4073,7 +4073,7 @@ class Actions
|
||||||
|
|
||||||
if (!$bAddHiddenRcpt)
|
if (!$bAddHiddenRcpt)
|
||||||
{
|
{
|
||||||
$aSmtpCredentials[] = array();
|
$aSmtpCredentials['HiddenRcpt'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$bHookConnect = $bHookAuth = $bHookFrom = $bHookFrom = $bHookTo = $bHookData = $bHookLogoutAndDisconnect = false;
|
$bHookConnect = $bHookAuth = $bHookFrom = $bHookFrom = $bHookTo = $bHookData = $bHookLogoutAndDisconnect = false;
|
||||||
|
|
|
||||||
|
|
@ -43,32 +43,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" style="position: relative">
|
<div class="modal-body" style="position: relative">
|
||||||
<div class="b-list-toopbar">
|
<div class="b-list-toopbar">
|
||||||
<input class="i18n span3 e-search" type="text" placeholder="Search" data-18n-placeholder="CONTACS/SEARCH_INPUT_PLACEHOLDER" data-bind="value: search" />
|
<input class="i18n span3 e-search" type="text" placeholder="Search" data-i18n-placeholder="CONTACTS/SEARCH_INPUT_PLACEHOLDER" data-bind="value: search" />
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
<div class="btn-toolbar b-list-toopbar g-ui-user-select-none">
|
|
||||||
<div class="btn-group">
|
|
||||||
<input class="i18n span3 e-search" type="text" placeholder="Search" data-18n-placeholder="CONTACS/SEARCH_INPUT_PLACEHOLDER" data-bind="value: search" />
|
|
||||||
</div>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<a class="btn dropdown-toggle button-filter" data-toggle="dropdown">
|
|
||||||
<i class="icon-bolt"></i>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu g-ui-menu">
|
|
||||||
<li class="e-item">
|
|
||||||
<a class="e-link">
|
|
||||||
Personal address book
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="e-item">
|
|
||||||
<a class="e-link">
|
|
||||||
Collected
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
<div class="b-list-content g-ui-user-select-none" data-bind="nano: true, css: {'hideContactListCheckbox': !useCheckboxesInList()}">
|
<div class="b-list-content g-ui-user-select-none" data-bind="nano: true, css: {'hideContactListCheckbox': !useCheckboxesInList()}">
|
||||||
<div class="content g-scrollbox">
|
<div class="content g-scrollbox">
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
|
|
|
||||||
|
|
@ -6907,10 +6907,10 @@ html.rl-no-preview-pane .messageList.message-selected {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
showImages html.rl-no-preview-pane .messageView {
|
html.rl-no-preview-pane .messageView {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
showImages html.rl-no-preview-pane .messageView.message-selected {
|
html.rl-no-preview-pane .messageView.message-selected {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.messageView {
|
.messageView {
|
||||||
|
|
|
||||||
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -8626,7 +8626,7 @@ PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom)
|
||||||
sSignature = sSignature.replace(/{{IF:FROM}}[\s\S]+{{\/IF:FROM}}/gm, '');
|
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;
|
return sSignature;
|
||||||
|
|
|
||||||
2
rainloop/v/0.0.0/static/js/app.min.js
vendored
2
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue