or auth = Auth(db, controller='handle', function='user'), but that means having to access /app/handle/user/login /app/handle/user/logout , etc ... i.e. request.args are the same as for the /myapp/default/user/whatever "url-style"
On Wednesday, February 27, 2013 12:34:01 PM UTC+1, Vixus wrote: > > Aha, I needed to read through all that stuff sometime. Might as well be > now. > > Thank you! > > On Tuesday, February 26, 2013 11:46:50 AM UTC, Niphlod wrote: >> >> it's all configured using auth.settings.... >> see >> http://web2py.com/books/default/chapter/29/09?search=auth.settings.login_url >> and following >> >> On Tuesday, February 26, 2013 1:34:59 AM UTC+1, Vixus wrote: >>> >>> Ok, I understand. But what if I want the auth stuff in a controller >>> called user, and not default? How do I prevent the redirections taking >>> place above? Shouldn't it have redirected to *user*/handle/login >>> instead of *default*/handle/login? >>> >>> On Monday, February 25, 2013 12:17:04 AM UTC, Niphlod wrote: >>>> >>>> auth works inspecting request.args and generating the corresponding >>>> form. >>>> in a "default" setup, you have auth defined into def user(), so the url >>>> is >>>> >>>> /app/default/user/login >>>> >>>> the function (connected to the view) is *user*, not *login*. *login*is the >>>> first request.args ( >>>> *request.args(0)*) >>>> It's perfectly fine that if you put return dict(form=auth()) inside def >>>> handle() it works only when accessed as >>>> /app/default/handle/login >>>> >>>> If you want /app/default/handle to return just the login form, you >>>> should return >>>> >>>> form=auth.login() >>>> >>>> directly (and have something else handling all other auth functions >>>> like register, logout, retrieve_username, etc etc etc) >>>> >>>> On Monday, February 25, 2013 12:52:05 AM UTC+1, Vixus wrote: >>>>> >>>>> By default auth seems to assume everything is under: >>>>> default/user/[login,register,etc.] >>>>> But I want to instead have everything under: >>>>> user/handle/[login,register,etc.] >>>>> So I moved the user() function from default.py to handle() in user.py. >>>>> >>>>> The reason I wanted to do this was so I could have a component >>>>> user/handle.load that I could add to any page via LOAD. I followed >>>>> the examples from the web2py docs to do this. So I have: >>>>> >>>>> views/default/index.html: >>>>> {{extend 'layout.html'}} >>>>> {{=LOAD('user','handle.load',ajax=True)}} >>>>> >>>>> views/user/handle.html: >>>>> {{=form}} >>>>> >>>>> But when I view the default page all I get is an error saying: *invalid >>>>> function (default/handle)* >>>>> Attempting to navigate to /app/user/handle.load directly results in >>>>> the same error. The URL has changed to /app/default/handle.load/login >>>>> >>>>> So there seems to be some implicit routing going on. How do I fix this. >>>>> >>>>> *OR* >>>>> >>>>> Is there a better way to be doing a sidebar login via a component? All >>>>> I want is a small login form in the sidebar, and a register button that >>>>> takes the user to the registration page. >>>>> Thanks! >>>>> >>>> -- --- 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/groups/opt_out.

