[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread weheh
raise HTTP(200) works great and is cleaner. Thanks.

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread Anthony
On Friday, March 23, 2012 12:54:00 AM UTC-4, weheh wrote: > > Anthony, I tried your > raise HTTP(200, response.render()) > vs. my > raise HTTP(200, SCRIPT(response.js)) > > I ran into a ticket complaining about my form not being defined, so > I'm back to my SCRIPT(). > Well, by defaul

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread Anthony
I mentioned this in another thread (https://groups.google.com/d/msg/web2py/XaHiLQHQ9X0/N8J1PqUxK6YJ), but an entirely different approach is to skip auth.login() altogether, write all the login logic yourself, and use auth.login_bare() just to check the submitted credentials (in addition to retu

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread Sebastien Stormacq
Thanks ! On Friday, March 23, 2012 12:57:10 PM UTC+1, weheh wrote: > > Sorry, last message got mangled somehow. Here goes again. > > Sebastian, here's what I'm using: > > >

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread weheh
Sorry, last message got mangled somehow. Here goes again. Sebastian, here's what I'm using: # model auth = Auth(db) ... def complete_login(form): from gluon import HTTP # do some stuff with form as necessary response.flash = 'You are now logged in' response.js = 'ajax("%s",[],":ev

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread weheh
Here's what I'm using: # controller def login(): On Mar 23, 7:30 pm, Sebastien Stormacq wrote: > Hello Anthony, > > Could you share your code for modal login ? > I am beginning with web2py and would love to learn from that example. > > Thanks > > Seb > > > > > > > > On Friday, March 23, 2012 4:

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-23 Thread Sebastien Stormacq
Hello Anthony, Could you share your code for modal login ? I am beginning with web2py and would love to learn from that example. Thanks Seb On Friday, March 23, 2012 4:08:51 AM UTC+1, Anthony wrote: > > @anthony: actually, on closer inspection, the doc does go into some >> details: >> http://

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread weheh
Anthony, I tried your raise HTTP(200, response.render()) vs. my raise HTTP(200, SCRIPT(response.js)) I ran into a ticket complaining about my form not being defined, so I'm back to my SCRIPT(). Traceback (most recent call last): File "N:\web2py\gluon\restricted.py", line 204, in restric

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread weheh
No, in fact it's not going anywhere in particular. I tried 200 then decided 303. Probably will return to 200. Thanks again. On Mar 23, 11:12 am, Anthony wrote: > > Thank you Anthony. You're my hero. Wasn't so hard after all. For those > > following, I did it by putting the response.js in myonacce

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread Anthony
> > Thank you Anthony. You're my hero. Wasn't so hard after all. For those > following, I did it by putting the response.js in myonaccept(form) > function and then, the last thing to do in that function is > > HTTP(303,SCRIPT(response.js)) > Typically, a 303 response would also set a "Locatio

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread Anthony
> > @anthony: actually, on closer inspection, the doc does go into some > details: > http://web2py.com/books/​default/chapter/29/4#HTTP-and-​redirect > > but I'm still experimenting with how to get it to execute a script. Someth

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread weheh
Thank you Anthony. You're my hero. Wasn't so hard after all. For those following, I did it by putting the response.js in myonaccept(form) function and then, the last thing to do in that function is HTTP(303,SCRIPT(response.js)) That did the trick. @pbreit: After it's all said and done, I am more

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread weheh
@anthony: actually, on closer inspection, the doc does go into some details: http://web2py.com/books/default/chapter/29/4#HTTP-and-redirect but I'm still experimenting with how to get it to execute a script.

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread weheh
@anothony: I'm not sure how to do the raise HTTP() and get it to execute the response.js. I looked in the doc but it's pretty thin on the subject. I'm going to look at the source to get an idea of how web2py does it (I've always been curious about this), but in the mean time, if you could shed some

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread pbreit
Why waste so much time and energy overcomplicating something that works perfectly out-of-the-box? 99% of projects do not benefit from a modal login. Modal log-ins can actually be worse since they don't always work everywhere and they don't always have a unique URL where you can send people. S

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread tsvim
I think this actually is a bug. I haven't looked at it more, but I changed my default controller/function to home/index When I login (regular login except for the following lines in my model) it returns me to default/index (my old controller still exists there until I finished refactoring the co

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread Anthony
> > When the browser receives a redirect response, it immediately issues the > redirect request without further processing the XHR object, so the > client-side web2py JS code never gets to process the > web2py-component-command header. > Note, this is not a web2py issue -- this is how XHR work

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread Anthony
> > > I believe auth.settings.login_next only has an effect when there is no > > session._auth_next (i.e., when the user goes directly to the login URL > > rather than getting there via an internal link or redirect). > > Your logic is sound, but I'm afraid this is not the case. I am > directly

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread weheh
Hi Anthony, again, many thanks for your valuable contributions to this group. > I believe auth.settings.login_next only has an effect when there is no > session._auth_next (i.e., when the user goes directly to the login URL > rather than getting there via an internal link or redirect). Your logic

[web2py] Re: auth.login() from inside a component in a dialog

2012-03-22 Thread Anthony
> > First, I ran into the problem I describe in another thread, which is > that I'm forced to do this: > > session._auth_next = auth.settings.login_next = URL(c='user', > f='login') > > because otherwise, session._auth_next will drive me to the default > index. > I believe auth.settings.logi