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 (<westgate6...@gmail.com>) 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 web2py+unsubscr...@googlegroups.com.
> 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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAFDb1rWHRtiJE3x0Puedo8tP5Wjhz59e-%2BJ7%3D4UH1sXT7V0WiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to