1. By analysing the web2py's code I find this line: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1520
Basically you should define a url to redirect when login fails. And internally açthe parameter ( next=??) that you want to do. https://github.com/web2py/web2py/blob/master/gluon/tools.py#L4309-L4311 Steps: 1.1 Search by "fail login" string. https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1520 1.2 Here it call the function call_or_redirect. https://github.com/web2py/web2py/blob/master/gluon/tools.py#L4310 1.3 That call a function and redirect https://github.com/web2py/web2py/blob/master/gluon/tools.py#L93 That you can pass a url in string format or a function URL() using parameters.. I don't was tested but I think that it so: auth.settings.on_failed_authentication = URL("YOUR ACTION") or auth.settings.on_failed_authentication = "YOUR ACTION" 2. In these section have what you want. : > http://web2py.com/books/default/chapter/29/09/access-control#Authentication Especifically this code: def mylogin(): return dict(form=auth.login()) def myregister(): return dict(form=auth.register()) def myprofile(): return dict(form=auth.profile()) You can expose auth action that youself created . 3. Logout instantly? Em quinta-feira, 23 de março de 2017 13:35:25 UTC-3, Happy Rob escreveu: > > > Hi guys > I'm trying to make a membership site but I'm struggling a little and would > love a little help > # 1. How can I select where go if login fails? Can I add something next to > the 'next=URL' that's similar? > # 2. How can I select so uses c/b/b3 to login instead of > c/default/user/login? > # 3. When I login, it logs me out instantly - how can I not logout > instantly? > > I'm on Pythonanywhere, and I've got an app called "c" > APP: c > ------------------------------------------ > MODEL: a.py... > db = DAL ('sqlite://storage.sqlite') > from gluon.tools import Auth > auth = Auth(db, controller='b') > > auth.settings.controller = 'b' > auth.settings.on_failed_authorization = URL('c',args='b/b3') > auth.settings.login_url = URL(request.application, 'c', 'b3') > auth.define_tables(username=False,signature=False) > ------------------------------------------ > CONTROLLER: b.py... > #home page > def b1(): > display_page = XML('<h1>Home Page</h1>') > return dict(display_page = display_page) > > #regn page > def b2(): > display_page = XML('<h1>Registration Page</h1>') > return dict(display_page = display_page, > form=auth.register(next=URL('b3'))) > > #login page > def b3(): > display_page = XML('<h1>Login Page</h1>') > return dict(display_page = display_page, > form=auth.login(next=URL('b4'))) > # 1. How can I select where go if login fails? Can I add something next to > the 'next=URL' that's similar? > > #members page > @auth.requires_login() > # 2. How can I select so uses c/b/b3 to login instead of > c/default/user/login? > def b4(): > auth.settings.login_url = URL('b', 'b3') > display_page = XML('<h1>Members Page</h1>') > return dict(display_page = display_page, > form=auth.logout(next=URL('b1'))) > # 3. When I login, it logs me out instantly (and sends me to b1) - how can > I not logout instantly? > ------------------------------------------ > VIEW: b/b1.html... > {{=display_page}} > > VIEW: b/b2 and b3 and b4 are the same... > {{=display_page}} > {{=form}} > ------------------------------------------ > > Any help would be greatly appreciated - especially with question 2. > -- 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.

