>
> 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.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). The idea is 
that when the user gets to the login via a redirect (i.e., trying to access 
a URL that requires login) or an internal link, they should be redirected 
back to their original page right after login. auth.settings.login_next is 
only intended as a default post-login redirect for other cases (I guess 
primarily if the user simply goes directly to the login URL itself).
 

> The other problem I have is that I can't figure out how to get the 
> flow of the form submission to recognize response.js and execute the 
> ajax call after login is completed. I've tried putting response.js 
> into a function in my 0_db.py file, like this: 
>
> def myonaccept(form): 
>     response.js = ... 
>
> auth.settings.login_onaccept = [myonaccept] 
>

The problem is that the auth.login() action does a redirect after running 
the onaccept callback, so I think your response.js is getting lost. You can 
probably solve both this problem and the session._auth_next redirect 
problem by having your onaccept callback itself do a redirect (to an action 
that then sets response.js) or even raise its own HTTP() response directly.

def login(): 
>     auth.settings.captcha = None 
>     login_form = auth.login() 
>     if login_form.accepts(request): 
>         response.flash = 'yo dude' 
>         response.js = util.clean_str( 
>             'ajax("%s",[],":eval");' % URL(c='user', 
> f='cb_after_login')) 


That won't work because auth.login() does its own form.accepts(), and in 
the case of a successful login, it does a redirect, which will prevent the 
rest of your code from executing.

Anthony 

Reply via email to