Web2py has auth.settings I used them to solve your problem
auth.settings.login_onaccept = lambda form: __on_login()
auth.settings.logout_onlogout = lambda user: __on_logout()
and then in the functions the task you want to perform, in my case
some set up things and messages, something like:
def __on_login():
# set up code
# messages
if auth.user.first_name:
name = auth.user.first_name + ' '
elif auth.user.title:
name = auth.user.title + ' '
if auth.user.familyNamePreposition:
name += auth.user.familyNamePreposition + ' '
name += auth.user.last_name
session.messages_logged_out = 'You have successfully logged out,
goodbye %s' %(name)
session.flash = 'You have successfully logged in, welcome %s' %(name)
return None
def __on_logout():
if session.forced_logout:
auth.messages.logged_out = session.forced_logged_out_message
else:
auth.messages.logged_out = session.messages_logged_out
return None
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/4cb15666-ee77-41c9-b769-70324770b90e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.