aboutsummaryrefslogtreecommitdiff
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-09-25 17:13:06 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-09-25 17:13:06 +0200
commitdc0374eca3267c1e429e8ae138e8e11ba48e1617 (patch)
treec29e29ae72c1ba27e3d6ba5159de064ce6128cc2 /phpBB
parentMerge branch '3.3.x' (diff)
parentMerge pull request #5135 from senky/ticket/15564 (diff)
downloadphpbb-dc0374eca3267c1e429e8ae138e8e11ba48e1617.tar.gz
phpbb-dc0374eca3267c1e429e8ae138e8e11ba48e1617.tar.bz2
phpbb-dc0374eca3267c1e429e8ae138e8e11ba48e1617.zip
Merge branch '3.3.x'
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/captcha_recaptcha.html3
-rw-r--r--phpBB/assets/javascript/core.js44
-rw-r--r--phpBB/language/en/captcha_recaptcha.php10
-rw-r--r--phpBB/language/en/common.php2
-rw-r--r--phpBB/styles/prosilver/template/captcha_recaptcha.html31
5 files changed, 57 insertions, 33 deletions
diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html
index 3f61c76cb1..563bd98835 100644
--- a/phpBB/adm/style/captcha_recaptcha.html
+++ b/phpBB/adm/style/captcha_recaptcha.html
@@ -5,8 +5,9 @@
<div>{L_RECAPTCHA_NOSCRIPT}</div>
</noscript>
+ {L_RECAPTCHA_INVISIBLE}
<script src="{RECAPTCHA_SERVER}.js?hl={LA_RECAPTCHA_LANG}" async defer></script>
- <div class="g-recaptcha" data-sitekey="{RECAPTCHA_PUBKEY}"></div>
+ <div class="g-recaptcha" data-sitekey="{RECAPTCHA_PUBKEY}" data-size="invisible"></div>
</dd>
</dl>
<!-- ELSE -->
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index db13b3653d..ab23a33c47 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -1646,6 +1646,50 @@ phpbb.lazyLoadAvatars = function loadAvatars() {
});
};
+var recaptchaForm = $('.g-recaptcha').parents('form');
+var submitButton = null;
+var programaticallySubmitted = false;
+
+phpbb.recaptchaOnLoad = function () {
+ // Listen to submit buttons in order to know which one was pressed
+ $('input[type="submit"]').each(function () {
+ $(this).on('click', function () {
+ submitButton = this;
+ });
+ });
+
+ recaptchaForm.on('submit', function (e) {
+ if (!programaticallySubmitted) {
+ grecaptcha.execute();
+ e.preventDefault();
+ }
+ });
+}
+
+phpbb.recaptchaOnSubmit = function () {
+ programaticallySubmitted = true;
+ // If concrete button was clicked (e.g. preview instead of submit),
+ // let's trigger the same action
+ if (submitButton) {
+ submitButton.click();
+ } else {
+ // Rename input[name="submit"] so that we can submit the form
+ if (typeof recaptchaForm.submit !== 'function') {
+ recaptchaForm.submit.name = 'submit_btn';
+ }
+ recaptchaForm.submit();
+ }
+}
+
+// reCAPTCHA doesn't accept callback functions nested inside objects
+// so we need to make this helper functions here
+window.phpbbRecaptchaOnLoad = function() {
+ phpbb.recaptchaOnLoad();
+}
+window.phpbbRecaptchaOnSubmit = function() {
+ phpbb.recaptchaOnSubmit();
+}
+
$(window).on('load', phpbb.lazyLoadAvatars);
/**
diff --git a/phpBB/language/en/captcha_recaptcha.php b/phpBB/language/en/captcha_recaptcha.php
index dde2a4ba08..68546ae73c 100644
--- a/phpBB/language/en/captcha_recaptcha.php
+++ b/phpBB/language/en/captcha_recaptcha.php
@@ -43,10 +43,10 @@ $lang = array_merge($lang, array(
'RECAPTCHA_INCORRECT' => 'The solution you provided was incorrect',
'RECAPTCHA_NOSCRIPT' => 'Please enable JavaScript in your browser to load the challenge.',
- 'RECAPTCHA_PUBLIC' => 'Public reCaptcha key',
- 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your public reCaptcha key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>.',
- 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key',
- 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>.',
+ 'RECAPTCHA_PUBLIC' => 'Site key',
+ 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your site reCAPTCHA key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>. Please, use reCAPTCHA v2 &gt; Invisible reCAPTCHA badge type.',
+ 'RECAPTCHA_PRIVATE' => 'Secret key',
+ 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your secret reCAPTCHA key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>. Please, use reCAPTCHA v2 &gt; Invisible reCAPTCHA badge type.',
- 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you complete the following challenge.',
+ 'RECAPTCHA_INVISIBLE' => 'This CAPTCHA is actually invisible. To verify that it works, a small icon should appear in right bottom corner of this page.',
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 83958b19b4..5b5bfd9a31 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -392,7 +392,7 @@ $lang = array_merge($lang, array(
'LOGIN_CHECK_PM' => 'Log in to check your private messages.',
'LOGIN_CONFIRMATION' => 'Confirmation of login',
'LOGIN_CONFIRM_EXPLAIN' => 'To prevent brute forcing accounts the board requires you to enter a confirmation code after a maximum amount of failed logins. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', // unused
- 'LOGIN_ERROR_ATTEMPTS' => 'You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to solve the CAPTCHA below.',
+ 'LOGIN_ERROR_ATTEMPTS' => 'You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to pass the CAPTCHA test.',
'LOGIN_ERROR_EXTERNAL_AUTH_APACHE' => 'You have not been authenticated by Apache.',
'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST' => 'A non-existant OAuth service has been requested.',
'LOGIN_ERROR_PASSWORD' => 'You have specified an incorrect password. Please check your password and try again. If you continue to have problems please contact the %sBoard Administrator%s.',
diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html
index a123f543a8..8fc7faa50f 100644
--- a/phpBB/styles/prosilver/template/captcha_recaptcha.html
+++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html
@@ -1,30 +1,9 @@
-<!-- IF S_TYPE == 1 -->
-<div class="panel captcha-panel">
- <div class="inner">
-
- <h3 class="captcha-title">{L_CONFIRMATION}</h3>
- <p>{L_CONFIRM_EXPLAIN}</p>
-
- <fieldset class="fields2">
-<!-- ENDIF -->
-
<!-- IF S_RECAPTCHA_AVAILABLE -->
- <dl>
- <dt><label>{L_CONFIRM_CODE}{L_COLON}</label><br /><span>{L_RECAPTCHA_EXPLAIN}</span></dt>
- <dd class="captcha">
- <noscript>
- <div>{L_RECAPTCHA_NOSCRIPT}</div>
- </noscript>
- <script src="{RECAPTCHA_SERVER}.js?hl={LA_RECAPTCHA_LANG}" async defer></script>
- <div class="g-recaptcha" data-sitekey="{RECAPTCHA_PUBKEY}" data-tabindex="<!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->"></div>
- </dd>
- </dl>
+ <noscript>
+ <div>{L_RECAPTCHA_NOSCRIPT}</div>
+ </noscript>
+ {% INCLUDEJS RECAPTCHA_SERVER ~ '.js?onload=phpbbRecaptchaOnLoad&hl=' ~ lang('RECAPTCHA_LANG') %}
+ <div class="g-recaptcha" data-sitekey="{RECAPTCHA_PUBKEY}" data-callback="phpbbRecaptchaOnSubmit" data-size="invisible" data-tabindex="<!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->"></div>
<!-- ELSE -->
{L_RECAPTCHA_NOT_AVAILABLE}
<!-- ENDIF -->
-
-<!-- IF S_TYPE == 1 -->
- </fieldset>
- </div>
-</div>
-<!-- ENDIF -->