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] <javascript:>>)
> 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] <javascript:>.
>> 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.