Closed mlhDevelopment closed 1 year ago
Hi @mlhDevelopment , and thx for submitting a reproducible example!
What would the expected behavior be in your case? recaptcha currently does not auto-reset on subsequent execute()
invocations. Would that be the behavior that you find the most ergonomic?
Hmm. I did not realize that. I can confirm that at https://stackblitz.com/edit/recaptcha2 Does v3 or non-invisible allow for repeated submit without resetting? We had resetting code but it forgets that the person just passed the captcha so it relentlessly challenges.
After looking into this further, I consider that this is working as intended. The purpose of execute()
is to generate a token, and this token is valid for one form submission towards the backend. If the token is acquired, but not used - this token should be memoized by the calling app (or, even better, the calling app should not request a reCAPTCHA challenge until the very last moment before the form submission).
See an example of this behavior here.
Since this is the behavior that should be controlled by the implementors, I will close this issue as "won't fix". If you think this behavior should be embedded in the lib, feel free to submit a new enhancement request, stating the desired behavior from ng-recaptcha
perspective.
Summary
I'm submitting a:
Description
Using a consolidated submit pattern (i.e. a single button click callback, intended to performs client side validation before calling execute to be more responsive), the second button click never resolves the token. The page has to be reloaded to complete the captcha or reset() must be called after every attempt.
Demo
https://stackblitz.com/edit/ng-recaptcha-example-gdnhr2 (if it says 'reCAPTCHA has already been rendered in this element' after loading make a change in the .ts file and it should come up)
null
after which the Execute button will work for a single click.Also discovered the same thing in the main example if you add logging to the execute button: https://stackblitz.com/edit/ng-recaptcha-example-x8cbpx
Lib versions:
tsc --version
): 4.0.2 (demo), 4.6.4 (discovered)