Merge remote-tracking branch 'origin/pull/13011'

This commit is contained in:
Michal Čihař 2017-02-20 16:29:36 +01:00
commit a280edc69f
3 changed files with 31 additions and 2 deletions

View File

@ -5022,6 +5022,34 @@ function toggleDatepickerIfInvalid($td, $input_field) {
}
}
/*
* Function to enable the 'Go' button on login.
*/
function login_go_button_enable() {
$('#input_go').prop('disabled', false);
}
/*
* Function to disable the 'Go' button on login.
*/
function login_go_button_disable() {
$('#input_go').prop('disabled', true);
}
/*
* Setting the 'Go' login button to disable if captcha is enabled.
*/
$(function ()
{
var captcha = $('.g-recaptcha').attr('captcha');
if(captcha=='enabled'){
login_go_button_disable();
}
});
/**
* Unbind all event handlers before tearing down a page
*/

View File

@ -228,7 +228,8 @@ class AuthenticationCookie extends AuthenticationPlugin
echo '<script src="https://www.google.com/recaptcha/api.js?hl='
, $GLOBALS['lang'] , '" async defer></script>';
echo '<div class="g-recaptcha" data-sitekey="'
, htmlspecialchars($GLOBALS['cfg']['CaptchaLoginPublicKey']) , '"></div>';
, htmlspecialchars($GLOBALS['cfg']['CaptchaLoginPublicKey']) ,
'" data-callback="login_go_button_enable" data-expired-callback="login_go_button_disable" captcha="enabled"></div>';
}
echo '</fieldset>

View File

@ -334,7 +334,7 @@ class AuthenticationCookieTest extends PMATestCase
);
$this->assertContains(
'<div class="g-recaptcha" data-sitekey="testpubkey">',
'<div class="g-recaptcha" data-sitekey="testpubkey" data-callback="login_go_button_enable" data-expired-callback="login_go_button_disable" captcha="enabled">',
$result
);
}