In the former case (the wrong one) is there a hidden field called
_next in the generated html? What does it say?

On Feb 18, 12:42 pm, Abner <abner.jacob...@gmail.com> wrote:
> Hi,
>
> Using the new auth system from gluon/tools.py I found a problem.
>
> My app is like this:
>
> model/db.py:
> ...
> auth = MyAuth(globals(), T, db
> auth.settings.lock_keys = False
> auth.settings.login_next = URL(r=request, c='default', f='index')
> auth.settings.login_url = URL(r=request, c='control', f='login')
> auth.define_tables()
>
> controller/default:
>
> @auth.requires_membership(TEACHERSGROUP)
> def index():
>     return dict(message=T('Hello World')
>
> views/default/index.html
>
> ... html code here ...
>
> vews/control/login.html
>
> ... vhtml code here ....
>
> The problem is: when I access default/index without loggedin I'm
> redirected to control/login, this is fine because I set
> auth.settings.login_url todo do this, but, after I sucessfully logged
> in I'm not redirect to default/index and stay in the login form.
> Web2py is ignoring my auth.settings.login_next = URL(r=request,
> c='default', f='index').
>
> After I changed the login code in gluon/tools from:
>
> ...
>         if not request.vars._next:
>             request.vars._next = request.env.http_referer or ''
>         if next == DEFAULT:
>             next = request.vars._next or self.settings.login_next
>         if onvalidation == DEFAULT:
> ...
>
> to this:
>
> ...
>         if not request.vars._next:
>             request.vars._next = request.env.http_referer or ''
>         if next == DEFAULT:
>             next = self.settings.login_next or request.vars._next # I
> CHANGED THIS LINE
>         if onvalidation == DEFAULT:
> ...
>
> The login behavior works correct, the user is redirect to /defeault/
> index after successfuly login. Is this a bug in the auth code or I was
> missing some point here ?
>
> thanks,
>
> Abner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to