I'm not sure I follow exactly what is going on, but note that with form =
auth(), all the login logic is handled inside of auth(), including any
redirects -- so the code may never get past that line.
Also, as an aside, if you define your callback functions to accept a single
argument (even though you won't use the argument), you don't have to wrap
them in lambdas.
Anthony
On Wednesday, December 9, 2015 at 9:26:31 AM UTC-5, Annet wrote:
>
> I have the following default/user function:
>
> auth.settings.login_onaccept = lambda form: __on_login()
> auth.settings.logout_onlogout = lambda user: __on_logout()
>
> def user():
> form = auth()
>
> if request.args(0) == 'login':
> if request.vars.setting == 'on_failed_authentication':
> get_flash(response, messages_authentication_failed, 'warning',
> 'custom')
>
> elif request.args(0)=='not_authorized':
> get_flash(session, auth.messages.access_denied, 'warning',
> 'custom')
> if auth.is_logged_in():
> redirect(URL('index'))
> else:
> redirect(URL('user', args='login'))
>
> return dict(form=form)
>
> __on_login builds a customized menu, stores some variables in session and
> sets
> a custom log_out message session.messages_logged_out
>
> all on_logout does is:
>
> auth.messages.logged_out = session.messages_logged_out
>
>
> When a user is logged in and his session expires he is being redirect to
> default/user/login,
> after proving his username and password, a flash displays the
> auth.messages.logged_out
> and the login form. After proving his username and password again the user
> is logged in.
>
>
> I don't see why the customizations I made interfere with web2py's access
> control,
> I hope one of you does.
>
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.