The Auth login method adds _next as a hidden input in the login form, so 
_next ends up in both request.get_vars and request.post_vars. Because 
request.vars combines get_vars and post_vars and each of those includes a 
"_next" key, request.vars ends up with _next being a list including the 
values from both get_vars and post_vars (which should be the same).

So, if you just want _next from the URL query string, you can use 
request.get_vars._next. But why do you need that -- the auth.login() action 
already handles redirecting to the _next URL after successful login?

Anthony

On Friday, October 27, 2017 at 4:46:14 AM UTC-4, Silvan Marco Fin wrote:
>
> Hi!
>
> I found the _next-parameter to become an array during login and I wonder 
> if this is a feature and if I'm using it "the right way(tm)".
>
> Situation is as follows:
>
> def user():
>     import logging
>     logging.warn('default/user _next={}'.format(request.vars._next))
>     return dict(form=auth(), next=request.vars._next)
>
> Browser displays page 'myapp/customer/accounts', the user is not logged in.
> There is a login button pointing to 
> 'myapp/default/user/login?_next=/myapp/customer/accounts'.
> The user presses the login-button, gives credentials, everything fine so 
> far.
>
> The user method is run twice as I understand, first to generate the form 
> and then to handle the submission.
>
> I get the following output: 
> WARNING:root:default/user _next=/myapp/customer/accounts
> WARNING:root:default/user _next=['/myapp/customer/accounts', 
> '/myapp/customer/accounts']
>
> Next thing I do is something like
> auth.settings.login_onaccept.append(my_login_hook)
> and I expected a single valued parameter _next and I get a multi valued 
> array. 
>
> Is this intentional?
>
> Are the values always the same or may the values in the array differ? 
> Which one is the "right one"?
>
> Kind regards,
> Silvan
>

-- 
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.

Reply via email to