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)
--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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:
To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
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.
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.
def user():
# just a way to ensure form allways have a value
form = CAT()
try:# the call to auth can return a lot of things
# it can be a form (a login form for example or a registration form)
# it can raise a redirect - for exple if the login is correct
# it can be the login form with erros if the password is incorrect
# etc
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, the user has logged in
do_your_loging_event_here() # ensuere u do the redirect, for example a raise shoul do it
elif 'logout' if request.args: do_your_logout_event_here()
# give the form to the view, can be register form, login form, etc
return dict(form=form)To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
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.
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.
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/sai3zh46gvQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/4cb15666-ee77-41c9-b769-70324770b90e%40googlegroups.com.