If you can ajax LOAD a whole form you can use this to add a recaptcha easily:
http://www.web2pyslices.com/slice/show/1584/adding-a-recaptcha-to-a-form 2014-03-07 2:09 GMT+01:00 Tim Richardson <[email protected]>: > > > On Friday, 7 March 2014 03:22:56 UTC+11, Paolo Valleri wrote: >> >> I agree with lightdot, the parameter is redundant. >> Mind that recaptcha library is splitted into two files, the first one >> (challenge) internally load a second one (recaptcha_canary.js). You made >> the former to be loaded with "ajax", the second is loaded dynamically in >> both the cases. Moreover the real library belongs to the second file, the >> first one contains only a few line of code >> > > Going over my head a bit. It seems that in the non-ajax api the first > Recaptcha script rewrites the document to inject the canary code, and this > doesn't happen when the script is itself loaded via ajax (as in a > component). How it works is up to Google, I just followed their ajax api. > > It seems to me that > a) we could completely move to using the ajax API (so my new parameter is > redundant since it's the only way we do it) > b) auto-detect ajax > c) let the developer choose > > (c) may be a temporary solution until we know that it works. Plus, we > already ask the developer to specify ajax functionality in other places, so > I'm not sure it's a big deal. > Personally, I'd like to go with the new parameter, which has a safe > default, mark it as experimental which is a licence to remove it, and > revisit it after it's had wider testing. > > As for 'people who want to use ajax can make a load component out of it', > that was what I was confronted with, but then I thought "LOAD is a web2py > feature, and a good one, so is Recaptcha. It's a bug that one doesn't work > with the other." > > > > > > > >> >> Paolo >> >> >> 2014-03-06 13:33 GMT+01:00 LightDot <[email protected]>: >> >> Well, if people want to use ajax for the recaptcha, they can make a load >>> component out of it. I think that the parameter really is redundant... >>> >>> Anyway, thanks for spotting & fixing this. >>> >>> Regards >>> >>> >>> >>> On Thursday, March 6, 2014 11:56:40 AM UTC+1, Tim Richardson wrote: >>>> >>>> >>>> >>>> On Thursday, 6 March 2014 18:29:40 UTC+11, Paolo Valleri wrote: >>>>> >>>>> I haven't tested, just an idea, instead of adding a new parameter, >>>>> what about checking current.request.ajax ? >>>>> >>>>> >>>> I didn't know about that. Does that mean that the client_side parameter >>>> in redirect is redundant? >>>> >>>> people may want to optionally use the ajax recaptcha API even in >>>> non-LOAD circumstances, since it probably gives faster perceived load >>>> times, so there is probably justification for the extra control that a >>>> parameter gives. >>>> However, perhaps the default can be changed to True in case of >>>> current.request.ajax. >>>> >>>> >>>> >>>> >>>> Paolo >>>>> >>>>> >>>>> 2014-03-06 0:59 GMT+01:00 Tim Richardson <[email protected]>: >>>>> >>>>>> I've made the PR, but my knowledge of jquery/javascript is >>>>>> paleolithic so Paolo is would be great if you can look at it. >>>>>> It works. >>>>>> https://github.com/web2py/web2py/pull/389 >>>>>> >>>>>> >>>>>> On Thursday, 6 March 2014 07:12:11 UTC+11, Tim Richardson wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Thursday, 6 March 2014 01:06:07 UTC+11, Paolo Valleri wrote: >>>>>>>> >>>>>>>> I run a couple of tests and I got the same issues, I am try to >>>>>>>> figure out why the js library (recaptcha_canary.js) is not loaded >>>>>>>> at all >>>>>>>> >>>>>>>> Paolo >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> I've opened issues 1888 and I've worked out how to fix it (see code >>>>>>> on the issue page). I'll make a PR today/tongith >>>>>>> >>>>>>>> >>>>>>>> 2014-03-05 12:17 GMT+01:00 Tim Richardson <[email protected]>: >>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wednesday, 5 March 2014 21:56:49 UTC+11, Paolo Valleri wrote: >>>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> Is it working without placing it in a component? >>>>>>>>>> have you tried to disable the facebook plugin? I'm just wondering >>>>>>>>>> if there is a correlation between the two. >>>>>>>>>> >>>>>>>>> >>>>>>>>> I removed the facebook plugin but it made no difference. >>>>>>>>> Yes, it works when not in a plugin. >>>>>>>>> The generated code is very different between the working example >>>>>>>>> and the LOAD. It seems that the Google javascript for recapture is not >>>>>>>>> being executed when LOAD is used. >>>>>>>>> When it works (no LOAD) there is a quite of lot of injected code >>>>>>>>> which is not present in the LOADed component. In Firebug, I'm told to >>>>>>>>> "reload the page to get source for http:..www.google.com/recpatch >>>>>>>>> a/..." so the <script> tag in the view by web2py isn't actually >>>>>>>>> working in LOAD >>>>>>>>> >>>>>>>>> The best thing would be to get recaptcha working in a >>>>>>>>> LOAD(ajax=True) component. Google has an ajax interface to recaptcha. >>>>>>>>> I >>>>>>>>> couldn't get it working but this is probably the best solution. >>>>>>>>> >>>>>>>>> Alternatives (LOAD ajax=False) don't get my anywhere. ajax=False, >>>>>>>>> ajax_trap=False is not useful since the request is sent back to the >>>>>>>>> parent >>>>>>>>> controller function, which knows nothing about the form defined in the >>>>>>>>> controller function for the component. >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Resources: >>>>>>>>> - http://web2py.com >>>>>>>>> - http://web2py.com/book (Documentation) >>>>>>>>> - http://github.com/web2py/web2py (Source code) >>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>>>>> --- >>>>>>>>> You received this message because you are subscribed to a topic in >>>>>>>>> the Google Groups "web2py-users" group. >>>>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>>>>>>>> topic/web2py/H8dOum7kpPA/unsubscribe. >>>>>>>>> To unsubscribe from this group and all its topics, send an email >>>>>>>>> to [email protected]. >>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>> Resources: >>>>>> - http://web2py.com >>>>>> - http://web2py.com/book (Documentation) >>>>>> - http://github.com/web2py/web2py (Source code) >>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>> --- >>>>>> You received this message because you are subscribed to a topic in >>>>>> the Google Groups "web2py-users" group. >>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to >>>>>> pic/web2py/H8dOum7kpPA/unsubscribe. >>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>> [email protected]. >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>> >>>>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>> topic/web2py/H8dOum7kpPA/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

