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

A built-in way to intercept a missing reCAPTCHA error? #135

Open
jogarijo opened this issue Jun 5, 2020 · 8 comments
Open

A built-in way to intercept a missing reCAPTCHA error? #135

jogarijo opened this issue Jun 5, 2020 · 8 comments

Comments

@jogarijo
Copy link
Contributor

jogarijo commented Jun 5, 2020

The problem to solve

While using an Apostrophe Forms with reCAPTCHA enabled, I want to enact specific actions when the reCAPTCHA is not checked on client-side.

Currently, it's not possible without watching for DOM mutations on the reCAPTCHA error message block or having a custom submit event that replicates the logic (cf lib/modules/apostrophe-forms-widgets/public/js/lean.js:50-53).

Proposed solution

Just like there are custom events triggered when the form is submitted (apostrophe-forms:submission-form on success, apostrophe-forms:submission-failed on error), there could be a similar event, like apostrophe-forms:submission-missing-recaptcha or something appropriately named.

Alternatives

Another possible solution would be to not check reCAPTCHA presence at all on client-side, and let the server send back an appropriate error. The missing reCAPTCHA event would thus be embedded just as another invalid field in the apostrophe-forms:submission-failed event.

@jogarijo jogarijo added the enhancement New feature or request label Jun 5, 2020
@abea abea added help wanted and removed enhancement New feature or request labels Jun 5, 2020
@abea
Copy link
Contributor

abea commented Jun 5, 2020

When might the reCATCHA not be checked client-side? When JS is disabled, maybe? For that case, a simple <noscript> tag with a message would do it. Or are you thinking about situations where there are other client side JS errors that prevent it from running?

@jogarijo
Copy link
Contributor Author

jogarijo commented Jun 6, 2020

The main scenario I suggest this for is when the user forgot to check the reCAPTCHA.

For example, let's say I have a long form and my first field is invalid. I scroll up to fix it and hit enter to validate the form. If the reCAPTCHA is off-screen, the error message that says my field is invalid is still there, but the actual problem is the reCAPTCHA that has been unchecked. It can be confusing, especially if I'm focused on the field itself.

I'm not sure if that's clear, I can make an example if needed.

@abea
Copy link
Contributor

abea commented Jun 17, 2020

Thanks, @jogarijo. An example might help. I don't know that this is something we will be able to make time for, but we'd be happy to review a PR.

@jogarijo
Copy link
Contributor Author

Will probably be opening one during the weekend then. 🙂

@scabralo
Copy link
Contributor

scabralo commented May 9, 2023

@abea Looks like this issue can be closed.

@abea
Copy link
Contributor

abea commented May 9, 2023

@scabralo I'm not with the core team anymore, so I'll leave it to one of them to close this and merge the other.

@boutell
Copy link
Member

boutell commented May 9, 2023

Bea just wants us to miss him more. (It's working!)

@abea
Copy link
Contributor

abea commented May 10, 2023

guilty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants