?
Referenced as Pull Request for: # 8191
avatar andrepereiradasilva
andrepereiradasilva
28 Oct 2015

Steps to reproduce the issue

The recaptcha do not work if you move the javascript execution to after the javascript onload event.

Configure recaptcha plugin with version 2.0 and put it working as default in system configuration.

Use any joomla plugin that allows you to move the javascript execution to after the page onload event. Load any page with the recaptcha form and see the recaptcha image does not load.

Potencial solution

Use HTML5 "data-*" attributes when loading recaptcha.

Instead of:
<script src="https://www.google.com/recaptcha/api.js?hl=__LANG__&amp;render=explicit" type="text/javascript">
[...]
<div id="jform_captcha" class=" required">
[...]
jQuery(document).ready(function($) {$(window).load(function() {grecaptcha.render("jform_captcha", {sitekey: "__RECAPTCHASITEKEY__", theme: "__RECAPTCHATHEME__"});});})

Use:
<script src="https://www.google.com/recaptcha/api.js?hl=__LANG__&amp;render=onload" type="text/javascript">
[...]
<div id="jform_captcha" class="g-recaptcha required" data-sitekey="__RECAPTCHASITEKEY__" data-theme="__RECAPTCHATHEME__"></div>

Code in: https://github.com/joomla/joomla-cms/blob/staging/plugins/captcha/recaptcha/recaptcha.php (functions onInit and onDisplay)

See also https://developers.google.com/recaptcha/docs/display#config

System information (as much as possible)

Joomla 3.4.5

avatar andrepereiradasilva andrepereiradasilva - open - 28 Oct 2015
avatar zero-24
zero-24 - comment - 28 Oct 2015

Cab you send you changes as pull request against the staging branch?

avatar andrepereiradasilva andrepereiradasilva - reference | 8da3451 - 28 Oct 15
avatar andrepereiradasilva
andrepereiradasilva - comment - 28 Oct 2015

ok done it.
See #8191

avatar zero-24 zero-24 - change - 29 Oct 2015
Category Plugins
avatar zero-24 zero-24 - change - 29 Oct 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-10-29 11:22:25
Closed_By zero-24
Labels Added: ?
avatar zero-24 zero-24 - close - 29 Oct 2015
avatar zero-24 zero-24 - close - 29 Oct 2015
avatar zero-24 zero-24 - close - 29 Oct 2015
avatar zero-24
zero-24 - comment - 29 Oct 2015

Closing as we have a Pull. Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8188.

Add a Comment

Login with GitHub to post a comment