Skip to content

Create a single reCaptcha plugin for both versions. #5888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from

Conversation

roland-d
Copy link
Contributor

This PR removes the noCaptcha plugin and merges it with the reCaptcha plugin. This way we have 1 reCaptcha plugin capable of using both the old and new keys depending on selected version.

Testing
To test, use reCaptcha version 1.0 with global keys and specific keys, all should continue to work as-is.
Also test version 2.0 with the new keys and you should get the new reCaptcha. The new keys also work with version 1.0.

After selecting the reCaptcha version, putting in the keys and selecting a theme. Check if the reCaptcha works on the front-end of the site.

@roland-d roland-d added this to the Joomla! 3.4.0 milestone Jan 26, 2015
@peterlose
Copy link
Contributor

@test Works fine.

Old version:

skaermbillede 2015-01-26 kl 11 07 37

New version:

skaermbillede 2015-01-26 kl 11 07 44

showon="version:2.0"
filter="">
<option
value="light">PLG_RECAPTCHA_THEME_LIGHT</option>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix the spacing here? :)

@infograf768
Copy link
Member

Typo:
+PLG_RECAPTCHA_VERSION_DESC="Choose the reCaptcha version neede for your keys"

testing now.

@@ -7,16 +7,22 @@ PLG_CAPTCHA_RECAPTCHA_XML_DESCRIPTION="This CAPTCHA plugin uses the reCAPTCHA se
PLG_CAPTCHA_RECAPTCHA="Captcha - ReCaptcha"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CAPTCHA - reCAPTCHA

As defined in style guide

@infograf768
Copy link
Member

@roland-d

I suggest to make it clearer that the new version (Version2 ?) does NOT accept Global keys.
Could be in the description or as a tip

@brianteeman
Copy link
Contributor

I agree with with @infograf768

Perhaps
+PLG_RECAPTCHA_VERSION_1="1.0"
+PLG_RECAPTCHA_VERSION_1_DESC="Required if using Global CAPTCHA keys."
+PLG_RECAPTCHA_VERSION_2="2.0"
+PLG_RECAPTCHA_VERSION_2_DESC="Recommended version."

@nikosdion
Copy link
Contributor

@test Success 👍

In detail:

  • Version 1.0 with global key: works as expected
  • Version 1.0 with site key: works as expected
  • Version 2.0 with global key: ReCAPTCHA complains about wrong key or domain as expected
  • Version 2.0 with site key: works as expected

Tested with front-end user registration and com_contact.

@infograf768
Copy link
Member

@test
Works fine here.

Just needs the improvements for the versions and we can merge, as we freeze langs tomorrow

@ghost
Copy link

ghost commented Jan 26, 2015

Seems a bit weird that version 2.0 is the 'Recommended version.', but version 1.0 is the default active one.

@roland-d
Copy link
Contributor Author

Thanks for testing everybody. I have updated the language files and believe they are good now.
@brianteeman I can't do a language string per version, so I have combined both into one.
Please check if all is OK now.

@nikosdion
Copy link
Contributor

@nonumber Having read the past discussions, this strange default value seems to spring from the need to have a continuity for people using global keys. Version 2 API doesn't support global keys. If version 2 was the default, sites using global keys upgrading to Joomla! 3.4 would no longer have a functioning ReCAPTCHA misleading users into believing that Joomla! 3.4 is "broken". I'm not a fan of this default value either, but it's the only compromise solution to cater for the people who don't read the release notes, i.e. virtually everybody using Joomla!.

@infograf768
Copy link
Member

OK for me

@nonumber
I guess this is for B/C reasons

@roland-d
Copy link
Contributor Author

Indeed that 1.0 is the default value, only reason is for backwards compatibility reasons. Those using global keys would on update have a broken reCAPTCHA. This way we ensure that keeps working.


; Params
PLG_RECAPTCHA_VERSION_LABEL="Version"
PLG_RECAPTCHA_VERSION_DESC="Version 1.0 is required if using Global CAPTCHA keys. Version 2.0 is the recommended version."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being picky I think it's worth saying deprecated Global CAPTCHA keys to make it clear it's google not allowing these keys which is why we cannot accept them

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed but it MUST say reCAPTCHA not CAPTCHA
reCAPTCHA is the service from google. CAPTCHA is the generic name

@brianteeman
Copy link
Contributor

@roland-d I would go with @wilsonge comment about stating that v1 is deprecated

@roland-d
Copy link
Contributor Author

Updated the strings again :)


; Params
PLG_RECAPTCHA_VERSION_LABEL="Version"
PLG_RECAPTCHA_VERSION_DESC="Version 1.0 is required if using deprecated Global reCAPTCHA keys. Version 2.0 is the recommended version."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be a PIA

Can you switch the order
+PLG_RECAPTCHA_VERSION_DESC="Version 2.0 is the recommended version. Version 1.0 is required if using the deprecated Global reCAPTCHA keys. "

@@ -36,12 +46,13 @@
size="50" />

<field
name="theme"
name="theme1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't rename the existing parameter as it would break the plugin for updating users who selected a custom theme. Just leave that as theme and change the code to fit. The new param for v2 is fine with theme2.

@Bakual
Copy link
Contributor

Bakual commented Jan 26, 2015

Can we show a deprecated warning in the module parameter view when v1 is selected or the version param is not yet saved? Could be done simple with a dummy formfield above the version field and the showon feature.
This way people would clearly see that they should choose v2 and it would solve the issue with the "wrong" default value (which we correctly have for BC reasons).

@roland-d
Copy link
Contributor Author

@Bakual Thanks on the theme parameter. It's fixed now. As for showing the message, that is fine by me. Just need to know what the text needs to be :)

case '1.0':
$theme = $this->params->get('theme', 'clean');

$server = self::RECAPTCHA_API_SERVER;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No biggy, but to make it more in line with the code for v2:

$server = $app->isSSLConnection() ? self::RECAPTCHA_API_SERVER : self::RECAPTCHA_API_SECURE_SERVER;

Or even just remove these global vars and do:

$file = $app->isSSLConnection() ? 'https' : 'http';
$file .= '://www.google.com/recaptcha/api/js/recaptcha_ajax.js';
JHtml::_('script', $file);

@roland-d
Copy link
Contributor Author

@nonumber Thanks for the suggestion, I have cleaned up the code per your suggestion.

@ghost
Copy link

ghost commented Jan 26, 2015

Nice

@Bakual
Copy link
Contributor

Bakual commented Jan 26, 2015

As for showing the message, that is fine by me. Just need to know what the text needs to be :)

Would need input from @brianteeman, but I would do something like "You have selected the deprecated version of this plugin. It's recommended to select version 2. Make sure you have supported keys for that version before switching."

@brianteeman
Copy link
Contributor

Displaying a message is good but I think the tone and meaning of that proposed text is not right.

I think it needs to say something like
"You have selected Version 1. All new sites should be using Version 2. Version 1 is only maintained to provide support for Global Site keys which are no longer available from Google."


; Params
PLG_RECAPTCHA_VERSION_1_WARNING_LABEL="You have selected Version 1. All new sites should be using Version 2. Version 1 is only maintained to provide support for Global Site keys which are no longer available from Google."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roland-d @brianteeman I think we should use also here Version 1.0 and Version 2.0 or not?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically both would be wrong.
On 26 Jan 2015 17:53, "zero-24" notifications@github.com wrote:

In administrator/language/en-GB/en-GB.plg_captcha_recaptcha.ini
#5888 (comment):

; Params
+PLG_RECAPTCHA_VERSION_1_WARNING_LABEL="You have selected Version 1. All new sites should be using Version 2. Version 1 is only maintained to provide support for Global Site keys which are no longer available from Google."

@roland-d https://github.com/roland-d @brianteeman
https://github.com/brianteeman I think we should use also here Version
1.0 and Version 2.0 or not?


Reply to this email directly or view it on GitHub
https://github.com/joomla/joomla-cms/pull/5888/files#r23549545.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops my mistake the api is indeed 1.0 and 2.0 I had thought they were higher numbers

@roland-d
Copy link
Contributor Author

Is it all good now or do we need more language updates?

@brianteeman
Copy link
Contributor

All good to me - thanks

@zero-24
Copy link
Contributor

zero-24 commented Jan 26, 2015

Thanks for testing and review moving to RTC based on various tests. Thanks!


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

@roland-d roland-d closed this in 43d726e Jan 27, 2015
@infograf768
Copy link
Member

Thanks. Merged after correcting also the installation sql files and en-GB.install.xml

@mManishTrivedi
Copy link

I want to work on it for Joomla but I am too late. 😔

Still I have submitted new plugin on JED for reCaptcha2. ☺️ Now I am finding new stuff for Joomla.

@roland-d roland-d deleted the recaptcha branch May 6, 2015 06:16
@zero-24 zero-24 mentioned this pull request Nov 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants