Skip to content
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

Recaptcha invisible #16599

Closed
wants to merge 6 commits into from
Closed

Conversation

kernusr
Copy link
Contributor

@kernusr kernusr commented Jun 9, 2017

Pull Request for Issue # .

Summary of Changes

Added invisible captcha on plg_captcha_recaptcha

Testing Instructions

  1. On https://www.google.com/recaptcha/admin select and create new invisible captcha.
  2. On Joomla Control panel activate and configur reCaptcha plugin
    2.1. Insert your public and private keys
    2.2. Select the Invisible version of catcha
    2.3. Chose any of reposition the reCAPTCHA badge
    (plagin setings http://joxi.ru/n2YVXzYUXBLOA6)
  3. On Global Configuration panel choose captcha-reCaptcha
  4. Create testing contact and enable the display of the contact form
  5. Publish a contact with the contact form on any page of the site

Tested it on frontend!

Expected result

If you fill out the form manually and press "send" - captcha recognizes the person in you and allows sending. You will see a message about the successful sending of the form http://joxi.ru/EA4Z4paiLydbmb

To capture the robot in you, execute this code several times in the browser console
jQuery('#display-form').collapse('show'); var form = document.getElementById('contact-form'), inputCollection = form.getElementsByTagName('input'), inputCount = inputCollection.length; for(var i = 0; i < inputCount; i++){ item = inputCollection[i]; if(item.type == 'text'){ item.value = "blah-blah-blah"; } else if(item.type == 'email'){ item.value = "blah@blah.blah"; } else if(item.type == 'checkbox'){ item.checked = true; } else{ continue; } } var textareaCollection = form.getElementsByTagName('textarea'), textareaCount = textareaCollection.length; for(var i = 0; i < textareaCount; i++){ item = textareaCollection[i]; if(item.id === 'g-recaptcha-response') continue; item.value = "blah_blah_blah"; } form.submit();

If everything is done correctly, you will see an error message http://joxi.ru/8An9b03sYQqx2O

After several unsuccessful attempts, try sending the form manually. Captcha will show suspicion to you
http://joxi.ru/YmE03kqHdxnWr6

Thanks!

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels Jun 9, 2017
});
}
}
}

Choose a reason for hiding this comment

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

Missing semicolon.

element = element.parentNode;
}
while (element.nodeName != 'FORM');
element.addEventListener('submit', function(event) {

Choose a reason for hiding this comment

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

Don't make functions within a loop.


window.sentForm.submit();
delete window.sentForm;
}

Choose a reason for hiding this comment

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

Missing semicolon.

});
}
}
}

Choose a reason for hiding this comment

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

Missing semicolon.

element = element.parentNode;
}
while (element.nodeName != 'FORM');
element.addEventListener('submit', function(event) {

Choose a reason for hiding this comment

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

Don't make functions within a loop.


window.sentForm.submit();
delete window.sentForm;
}

Choose a reason for hiding this comment

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

Missing semicolon.

@@ -33,6 +34,11 @@ PLG_RECAPTCHA_SIZE_LABEL="Size"
PLG_RECAPTCHA_SIZE_DESC="Select the size for the reCAPTCHA field."
PLG_RECAPTCHA_THEME_NORMAL="Normal"
PLG_RECAPTCHA_THEME_COMPACT="Compact"
PLG_RECAPTCHA_BADGE="Reposition the reCAPTCHA badge"
PLG_RECAPTCHA_BADGE_DESC="Reposition the reCAPTCHA badge. 'inline' allows you to control the CSS."
PLG_RECAPTCHA_BADGE_BOTTOMRIGHT="Bottomright"
Copy link
Contributor

Choose a reason for hiding this comment

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

Bottom right, two words

PLG_RECAPTCHA_BADGE="Reposition the reCAPTCHA badge"
PLG_RECAPTCHA_BADGE_DESC="Reposition the reCAPTCHA badge. 'inline' allows you to control the CSS."
PLG_RECAPTCHA_BADGE_BOTTOMRIGHT="Bottomright"
PLG_RECAPTCHA_BADGE_BOTTOMLEFT="Bottomleft"
Copy link
Contributor

Choose a reason for hiding this comment

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

Bottom left, two words

@Quy Quy mentioned this pull request Jun 9, 2017
@810
Copy link
Contributor

810 commented Jun 9, 2017

I have tested this item ✅ successfully on 9debe28


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

@yvesh
Copy link
Member

yvesh commented Jun 9, 2017

General question: Are you sure you want to add this to the current recaptcha plugin instead of creating a new one? It has a slightly different API + markup + other JS include (so we have a lot if else now) ..

Not sure if it's worth it, but personally i have the feeling that having two plugins would make people's life easier.

@kernusr
Copy link
Contributor Author

kernusr commented Jun 10, 2017

@yvesh To create a new plug-in, you need to make changes to all the templates that use captcha
This is a lot of work and it is advisable to perform it on a new version (for example, on Joomla 4) For the new plug-in to work properly, you will have to make changes to all the templates in which the captcha is called.
In its present form, this is the management with the support of the new function and nothing more
This is my opinion and I'm ready to listen to criticism

@roland-d
Copy link
Contributor

roland-d commented Jul 9, 2017

I think it is OK to do it in this plugin, for the end user it is just another version they can select. For J4 we could decide to drop V1, is anybody still using that is something we can wonder.

Edit: When I created the invisible key, I can't even create a version 1 key anymore.

@roland-d
Copy link
Contributor

roland-d commented Jul 9, 2017

@kernusr All is working fine, the only thing I have a question about is how things are rendered. With the icon set to the right or left bottom it looks like this:
image

We have a Captcha field with a * that it is required and that may look confusing. I guess when we render the invisible captcha we shouldn't show the captcha field at all.

@allrude
Copy link

allrude commented Jul 10, 2017

Version 1.0 of the reCAPTCHA API is no longer supported, please upgrade to Version 2.0.

No more reCaptcha 1.0 so we can drop that I guess, it only leads to problems if that option does not function.

thanks for this PR and the people that made an effort to test it


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

@brianteeman
Copy link
Contributor

Version 1 is not supported but still works
Version 1 supported wildcards.

So if you had used wildcards and we remove support for v1 we break captcha on that site and they will need to get a new key for each domain

@kernusr
Copy link
Contributor Author

kernusr commented Jul 11, 2017

I completely agree with @brianteeman . At the moment, many people continue to use ReCaptcha v1 and disabling this feature will lead to problems in the operation of sites.
However, in Joomla 4 it is more reasonable to remove support for reCaptcha v1. This will not cause such problems because administrators and developers will have to carefully check each site that they update to Joomla 4. And getting a new key for each domain will not be a big deal.

@kernusr
Copy link
Contributor Author

kernusr commented Jul 11, 2017

@roland-d

We have a Captcha field with a * that it is required and that may look confusing. I guess when we render the invisible captcha we shouldn't show the captcha field at all.

I will try to solve this problem in the near future

@roland-d
Copy link
Contributor

roland-d commented Jul 11, 2017

We can't remove Version 1 now anyway because that would be a B/C break :) Having the discussion on where it is going is good.

I will try to solve this problem in the near future

Good. Let me know and I will test again.

@kernusr
Copy link
Contributor Author

kernusr commented Jul 11, 2017

Quote from developers.google.com:

If your site still uses reCAPTCHA v1, please update to reCAPTCHA v2 immediately. We no longer support reCAPTCHA v1, and can longer guarantee it will continue functioning. Please register a new key and upgrade to v2.

Google will no longer support ReCaptcha 1 and strongly recommends that you upgrade keys to reCaptcha 2. Why should we leave compatibility with a product that is no longer being accompanied?
I think that there is no point in supporting RePaptcha 1 in Joomla 4. Just need to add a message that you need to update the keys to re-access 2 similar to the message about switching to PHP 7. like this http://joxi.ru/KAgXBMEignxlDr only for reCaptcha

@zero-24
Copy link
Contributor

zero-24 commented Jul 11, 2017

Just need to add a message that you need to update the keys to re-access 2 similar to the message about switching to PHP 7. like this http://joxi.ru/KAgXBMEignxlDr only for reCaptcha

I would go via a postinstall and not a message like the PHP one as not all sites uses this catcha and also not all of them use version 1. But i think this sould be a different issue. Can you open a new issue for that? I think i can build a postinstall for that issue than. And we can focus here on the catcha v3 ;)

@ghost
Copy link

ghost commented Aug 18, 2017

If this PR get no Response, it will be closed at 17th September 2017.

@roland-d
Copy link
Contributor

@kernusr Do you have time to follow up on this?

@gwsdesk
Copy link

gwsdesk commented Sep 5, 2017

This should not be closed since we have many requirements from users on the forums for this patch

@roland-d
Copy link
Contributor

roland-d commented Sep 5, 2017

That is why I asked if @kernusr is going to follow-up. If not, I can redo the patch.

@alikon alikon mentioned this pull request Sep 8, 2017
element = element.parentNode;
}
while (element.nodeName != 'FORM');
element.addEventListener('submit', function(event) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to hide the captcha field from the form (and just have the badge on the right or left bottom), we could add, in the if (widgetId !== ''):

if (item.getAttribute('data-badge') == 'bottomright' || item.getAttribute('data-badge') == 'bottomleft') {
	var bloc = element.parentNode.parentNode;
	bloc.style.margin = '0';
	if (bloc.hasChildNodes()) {				
		bloc.children[0].style.display = 'none';
	}
}

@ghost
Copy link

ghost commented Sep 17, 2017

as this got Response Status is set on "Discussion".


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

@paulus103
Copy link

Hi - this seems a good feature to implement :)

@drtothferenc19
Copy link

no update with this?

@drtothferenc19
Copy link

Sounds great

@Quy
Copy link
Contributor

Quy commented May 12, 2018

@roland-d Do you have time to redo this PR? Thanks.

@continga
Copy link

Why should we redo this PR? We have #18146

@roland-d
Copy link
Contributor

I agree, let's keep this in 1 PR and the other PR also makes it a standalone plugin which seems to be way to go.

@roland-d roland-d closed this May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators
Projects
None yet
Development

Successfully merging this pull request may close these issues.