-
Notifications
You must be signed in to change notification settings - Fork 255
Improvement: Generate recaptcha script on demand. closes #175 #176
Conversation
@felixmosh First of all, I'd like to thank you for this PR! I like this feature and I think this could partially solve #175 Here are some comments:
|
I've wrote that fix in order to solve #175 :] |
This looks good to me. Question: If I have my own If that's the case, I don't see a good way to fix it. Perhaps we should consider encouraging the dynamic loading (i.e. removing the |
@TheSharpieOne I'd love to hear your thoughts on this one. |
LGTM, though I'm not a fan of the new test style, but it does have better coverage so I cannot complain. One small thing that is no big deal if it happens. If a use manually adds the script tag (such as they are currently doing), there is a chance that the script is still being downloaded (since they are async) when this new code is executed which will cause another script tag to be added. To this fix we could look at all of the script tags currently on the page, determine that none are for recaptcha (by looking at the src attr) and then proceed to add our own. |
Ok, yeah, the duplicate script is an issue, and the author tweaked the documentation to remove the recaptcha script from the setup instructions for that reason. I think we should release this as a major version increment, in order to encourage users to remove their script tag. Thoughts? @felixmosh would you like to implement the check that @TheSharpieOne suggested? It could be addressed as a separate issue otherwise, but would be great if you could. |
👍 major version bump to avoid |
@mtrias, it should not happen. The current implementation suffers from a more common problem (#175). |
@felixmosh Can you update the PR description to indicate that #175 will be closed once this is merged? |
Done |
ok, fair enough! It seems like we are ready to merge then. I'll proceed with the merge, release tag, npm publish and release notes. Thank you all! |
Having just installed Reproduction:
Otherwise I'll open a new issue on this in 4.0.0. |
@lerignoux whenever u inject the service, it should append the script tag. |
No need to load recaptcha script on the html if one of the views uses it.
Load it on demand when vcRecaptchaService is injected in the first time.
closes #175