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

Validate completion executes more than once; every 120 seconds. #29

Closed
MaximusMcCann opened this issue Mar 6, 2018 · 11 comments · Fixed by #30
Closed

Validate completion executes more than once; every 120 seconds. #29

MaximusMcCann opened this issue Mar 6, 2018 · 11 comments · Fixed by #30

Comments

@MaximusMcCann
Copy link

MaximusMcCann commented Mar 6, 2018

I call validate(on: view, completion: completion). If I sit there (pretend the user is slow/reading something) the completion continuously calls about every 120 seconds, or, eventually the captcha dialog (img selection) shows up.

ReCaptcha v1.1

@fjcaetano
Copy link
Owner

fjcaetano commented Mar 6, 2018

I'm not really sure I understood what's going on. Please, correct me if I'm wrong:

Is your completion closure being called multiple times when the validation takes over 120s? If so, is it taking a long time to load, or is the app idle on the image selection screen?

How can I reproduce this issue? Should I just wait when the challenge shows up?

@MaximusMcCann
Copy link
Author

MaximusMcCann commented Mar 6, 2018

I click a button that calls validate. The captcha comes back successfully, but if I just sit there eventually it completes again with a new captcha. And it's every 120 seconds. This even happens if I call stop() as well. This does not involve the image selection.

@MaximusMcCann
Copy link
Author

Attached is a simple example. Set your api key and url in the ViewController class. Build + run. Click the button that says "Click me". Wait a few minutes and watch the debug logs/label on the app screen.
ReCaptchaDemo.zip

@MaximusMcCann
Copy link
Author

MaximusMcCann commented Mar 7, 2018

Some example logs:

2018-03-07 10:53:03.629703-0600 demo[88855:5074786] [MC] Lazy loading NSBundle MobileCoreServices.framework
2018-03-07 10:53:03.629873-0600 demo[88855:5074786] [MC] Loaded MobileCoreServices.framework
" ---  calling validate"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"Validate Completed 1 times.  Started 11.648964881897 seconds ago"
"Captcha: <ACTUAL CAPTCHA KEY>"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"Validate Completed 2 times.  Started 144.590750932693 seconds ago"
"Captcha: <ACTUAL CAPTCHA KEY>"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"
"--- recaptcha Config"

@MaximusMcCann
Copy link
Author

Additionally, adding self?._recaptcha?.stop() after case .success(let captcha): does not prevent the continued callbacks

@fjcaetano
Copy link
Owner

fjcaetano commented Mar 7, 2018

I found the issue, now I'm working on a solution.

Apparently, Google's API keep calling some URL, and the lib is understanding that as a cue to validate again.

Thanks for the input, nevertheless.

@fjcaetano
Copy link
Owner

@MaximusMcCann could you check if the branch fix/consecutive-completion-calls fixes the issue for you, please? It'd be great if you could approve #30 if it does.

@MaximusMcCann
Copy link
Author

@fjcaetano Appears fixed. Here's the total debug logs after 12+ minutes

2018-03-07 15:29:49.784217-0600 demo[2145:5653280] [MC] Lazy loading NSBundle MobileCoreServices.framework
2018-03-07 15:29:49.786431-0600 demo[2145:5653280] [MC] Loaded MobileCoreServices.framework
[JS LOG]: did load
" ---  calling validate"
[JS LOG]: executing
[JS LOG]: <ACTUAL CAPTCHA>
"Validate Completed 1 times.  Started 0.13608705997467 seconds ago"
"Captcha: <ACTUAL CAPTCHA>"
2018-03-07 15:32:03.837373-0600 demo[2145:5653280] [Accessibility] WKContentView[@] set up: @ pid: @ MACH_PORT -1199399936

Noting the JS Logging is on.

@fjcaetano
Copy link
Owner

Hi @MaximusMcCann, you've been quite active in the repository lately and I assume that you're using it commercially, so I'd love to know if you're interested in becoming a collaborator of the project and help me maintain it in the long run. What do you say?

@MaximusMcCann
Copy link
Author

@fjcaetano Appreciate the consideration! Not able to take on extra projects at this time though. As things arise I will certainly help where I can though, cheers!

@fjcaetano
Copy link
Owner

No problem. Let me know if you ever want to become a contributor.

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

Successfully merging a pull request may close this issue.

2 participants