I have the following setting:

auth.settings.login_next = URL('cms', 'default', 'my_login')

'my_login' takes care of generating a menu and setting some
varaible depending on who logs in.

Normally the function redirects to /cms/default/index

In my application I have a few buttons that href functions for which
login is required:

<a class="btn btn-default" href="{{=URL('cms', 'group', 'connect', 
args=request.args())}}" role="button">


The connect function is decorated the following way:

@auth.requires(lambda: auth.has_membership(ROOT) or 
auth.has_membership(GROUP))
def connect():
    return dict(form=form)

The first problem is that the 'group' controller needs the menu to be 
generated, so the call to
'connect' fails.


I thought of replacing the button with:

<a class="btn btn-default" href="{{=URL('cms', 'default', 'user', 
args='login')}}" role="button">

and probably adding vars=dict(next='URL('cms', 'group', 'connect', 
args=request.args())')
But it's not the login function that needs the 'next' var but the 
'my_login' function.

I wonder whether there is an easier way to get the behavior I want.


Kind regards,

Annet

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to