you can change this auth.settings.controller = 'sandbox'
On Nov 1, 10:47 am, Thadeus Burgess <[email protected]> wrote: > I have also noticed that if you define ~~~def user(): auth() in a controller > other than default, and you decorate a function auth.requires_login. It will > attempt to always redirect you to /init/default/user/login instead of > /init/sandbox/user/login > > I can't find the post that mentioned this problem. > > -Thadeus > > On Sun, Nov 1, 2009 at 10:29 AM, mdipierro <[email protected]> wrote: > > > Thank you Anton, > > > the ?_next is required to pass the original url to the login page in > > order to generate the hidden field in the login form. It is not used > > when the post is submitted. > > > You are right, there is a bug that causes redirection to the wrong > > url. I think I just fixed it in trunk. > > Can you please give it a try? > > > massimo > > > On Nov 1, 10:05 am, "[email protected]" <[email protected]> wrote: > > > Hello everybody, > > > > first of all I want to say thank you for creating and supporting this > > > magnificent web2py framework, I really enjoy working with it. > > > > Now I ran into an issue which may be originating from the > > > gluon.tools.Auth.requires_*() routines, which I found no topic about > > > in the news group. > > > > To reproduce the issue do the following: > > > - download and extract the web2py packet (1.71.0 - the latest one > > > today) > > > - start web2py and create a new application - say "sandbox" > > > - within the controllers directory create a new controller - say > > > "sandbox.py" > > > - within this controller "sandbox.py" write the following: > > > > @auth.requires_login() > > > def sandboxindex(): > > > return dict(message="hello from sandbox.py") > > > > - Now try to navigate to this URL: > >http://127.0.0.1:8000/sandbox/sandbox/sandboxindex > > > => you end up with a login form (which is what you want, of course) > > > => looking at the URL of the login form you can read: > >http://127.0.0.1:8000/sandbox/default/user/login?_next=/sandbox/defau... > > > (I do not understand why this URL parameter _next is used here, since > > > the login form is a "POST" form?) > > > => in the source code of the form you will find: > > > <input name="_next" type="hidden" value="/sandbox/default/ > > > sandboxindex" /> > > > (which is NOT what you wanted.) > > > > Instead of value="/sandbox/default/sandboxindex" it should read > > > value="/sandbox/sandbox/sandboxindex" in order to redirect to the > > > correct controller/function after successful login. > > > > Do I need to change anything in my application(s) or is this really an > > > issue with the web2py Auth class? > > > Is there a conflict with default settings for auth.settings.login_next > > > in the scaffolding application? (In the "real" application am working > > > on I do not define a auth.settings.login_next parameter, too) > > > > Some background information: > > > > Environments: > > > - started web2py on Windows XP with: web2py_no_console.exe --taskbar -- > > > ip=127.0.0.1 --port=8000 --password=web2py_pwd > > > - started web2py on Debian (lenny): nohup python web2py/web2py.py -p > > > 8001 -i 127.0.0.1 -a '<recycle>' & > > > > web2py version: > > > - 1.71.0 (latest one today) > > > - test application "sandbox" created with 1.71.0, too > > > > I appreciate your help! > > > > Kind regards, > > > Toni > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

