Bugfix: bootstrap jQuery('#') syntax error

Changed: use ES2015
Changed: gulp uglify to terser
Removed: ChangePassword
Removed: nanoscroll
Removed: JS polyfills
This commit is contained in:
djmaze 2020-03-13 15:30:39 +01:00
parent 9aa0cf92a9
commit aae7883b99
133 changed files with 15 additions and 10295 deletions

View file

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 RainLoop Team
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,3 +0,0 @@
A CAPTCHA (v2) is a program that can generate and grade tests that humans can pass but current computer programs cannot.
For example, humans can read distorted text as the one shown below, but current computer programs can't.
More info at http://www.google.com/recaptcha

View file

@ -1 +0,0 @@
2.2

View file

@ -1,151 +0,0 @@
<?php
class RecaptchaPlugin extends \RainLoop\Plugins\AbstractPlugin
{
/**
* @return void
*/
public function Init()
{
$this->UseLangs(true);
$this->addJs('js/recaptcha.js');
$this->addHook('ajax.action-pre-call', 'AjaxActionPreCall');
$this->addHook('filter.ajax-response', 'FilterAjaxResponse');
}
/**
* @return array
*/
public function configMapping()
{
return array(
\RainLoop\Plugins\Property::NewInstance('public_key')->SetLabel('Site key')
->SetAllowedInJs(true)
->SetDefaultValue(''),
\RainLoop\Plugins\Property::NewInstance('private_key')->SetLabel('Secret key')
->SetDefaultValue(''),
\RainLoop\Plugins\Property::NewInstance('theme')->SetLabel('Theme')
->SetAllowedInJs(true)
->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION)
->SetDefaultValue(array('light', 'dark')),
\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 'CaptchaNew/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())
{
$bResult = false;
$sResult = $this->Manager()->Actions()->Http()->SendPostRequest(
'https://www.google.com/recaptcha/api/siteverify',
array(
'secret' => $this->Config()->Get('plugin', 'private_key', ''),
'response' => $this->Manager()->Actions()->GetActionParam('RecaptchaResponse', '')
)
);
if ($sResult)
{
$aResp = @\json_decode($sResult, true);
if (\is_array($aResp) && isset($aResp['success']) && $aResp['success'])
{
$bResult = true;
}
}
if (!$bResult)
{
$this->Manager()->Actions()->Logger()->Write('RecaptchaResponse:'.$sResult);
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);
}
}
}
}
}

View file

@ -1,95 +0,0 @@
(function ($, window) {
$(function () {
var
nId = null,
bStarted = false
;
function ShowRecaptcha()
{
if (window.grecaptcha && window.rl)
{
if (null === nId)
{
var
oEl = null,
oLink = $('.plugin-mark-Login-BottomControlGroup')
;
if (oLink && oLink[0])
{
oEl = $('<div class="controls"></div>');
$(oLink[0]).after(oEl);
nId = window.grecaptcha.render(oEl[0], {
'sitekey': window.rl.pluginSettingsGet('recaptcha', 'public_key'),
'theme': window.rl.pluginSettingsGet('recaptcha', 'theme')
});
}
}
}
}
window.__globalShowRecaptcha = ShowRecaptcha;
function StartRecaptcha()
{
if (!window.grecaptcha && window.rl)
{
$.getScript('https://www.google.com/recaptcha/api.js?onload=__globalShowRecaptcha&render=explicit&hl=' + window.rl.settingsGet('Language'));
}
else
{
ShowRecaptcha();
}
}
if (window.rl)
{
window.rl.addHook('user-login-submit', function (fSubmitResult) {
if (null !== nId && !window.grecaptcha.getResponse(nId))
{
fSubmitResult(105);
}
});
window.rl.addHook('view-model-on-show', function (sName, oViewModel) {
if (!bStarted && oViewModel &&
('View:RainLoop:Login' === sName || 'View/App/Login' === sName || 'LoginViewModel' === sName || 'LoginAppView' === sName) &&
window.rl.pluginSettingsGet('recaptcha', 'show_captcha_on_login'))
{
bStarted = true;
StartRecaptcha();
}
});
window.rl.addHook('ajax-default-request', function (sAction, oParameters) {
if ('Login' === sAction && oParameters && null !== nId && window.grecaptcha)
{
oParameters['RecaptchaResponse'] = window.grecaptcha.getResponse(nId);
}
});
window.rl.addHook('ajax-default-response', function (sAction, oData, sType) {
if ('Login' === sAction)
{
if (!oData || 'success' !== sType || !oData['Result'])
{
if (null !== nId && window.grecaptcha)
{
window.grecaptcha.reset(nId);
}
else if (oData && oData['Captcha'])
{
StartRecaptcha();
}
}
}
});
}
});
}($, window));