Yoel, where could I look up how this works about the exception 303? Because I don't understand that part at all - I am not aware of exception being raised, why, and how it works in the flow - could you please point me to the direction where it's explained?
On Monday, June 17, 2019 at 10:16:58 AM UTC-4, Yoel Benitez Fonseca wrote: > > no, it is not. > > The first time the default/user is called - in the login process for > example - there not a HTTP(303) (redirect) exception, and the user get the > form. > The second time, in this scenery, the call to auth() will cause a redirect > (HTTP exception) and the user is effectively logged into the system. > > The same goes for the logout, but there is not a form in the middle. > > El lun., 17 jun. 2019 a las 9:57, Vlad (<[email protected] <javascript:>>) > escribió: > >> but isn't such a scenario catching a user in a process of logging in or >> logging out, but before actual login/logout? >> >> On Monday, June 17, 2019 at 9:44:10 AM UTC-4, Yoel Benitez Fonseca wrote: >>> >>> I think you can do it in the default/user function. Having in account >>> that the call to auth() probably raises a HTTP exceptiong in case of a >>> success. This example is only a proof of concept: >>> >>> def user(): >>> form = CAT() >>> >>> try: >>> form = auth() >>> except HTTP as e: >>> if e.status == 303'login' in request.args: >>> if ('login' in request.args) and auth.user: >>> # probably a success, u can test if auth.user is o not None >>> do_your_loging_event_here() >>> elif 'logout' if request.args: >>> do_your_logout_event_here() >>> >>> return dict(form=form) >>> >>> >>> >>> El lun., 17 jun. 2019 a las 9:19, Vlad (<[email protected]>) escribió: >>> >>>> What would be the simplest way to intercept login and logout? >>>> (i.e. I'd like to perform some additional tasks when a user is logged >>>> in, and when a user is logged out.) >>>> web2py elegantly hides the functionality in default.user under >>>> form=auth() and {{=form}} and somehow I can't think of a simple way to be >>>> notified about successful login and logout actions... >>>> >>>> -- >>>> 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]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> -- >>> Msc. Yoel Benítez Fonseca >>> >>> >>> >>> >>> >>> >>> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Msc. Yoel Benítez Fonseca > > > > > > > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/237c7ee1-72d9-4f3b-a3f5-f09fd34459ad%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

