diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-04-25 17:15:26 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-04-25 17:15:26 -0400 |
commit | cc8337da9046bff5243672e20f1dea9c18b00da6 (patch) | |
tree | 77ade69869105f1838df5e8616bb994844507cec /django_authopenid/views.py | |
parent | 3122fb8a2599944e623c8e21f285a9e4dd9e132a (diff) | |
parent | 02510a462392dd2e9e46e945d51efb374e0dc06f (diff) | |
download | askbot-cc8337da9046bff5243672e20f1dea9c18b00da6.tar.gz askbot-cc8337da9046bff5243672e20f1dea9c18b00da6.tar.bz2 askbot-cc8337da9046bff5243672e20f1dea9c18b00da6.zip |
merged newer ui branch to master
Diffstat (limited to 'django_authopenid/views.py')
-rwxr-xr-x | django_authopenid/views.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/django_authopenid/views.py b/django_authopenid/views.py index 3c794a0d..4f7d3efa 100755 --- a/django_authopenid/views.py +++ b/django_authopenid/views.py @@ -71,6 +71,7 @@ from forum.utils.forms import get_next_url EXTERNAL_LOGIN_APP = settings.LOAD_EXTERNAL_LOGIN_APP() +#todo: decouple from forum def login(request,user): from django.contrib.auth import login as _login from forum.models import user_logged_in #custom signal @@ -80,14 +81,27 @@ def login(request,user): #1) get old session key session_key = request.session.session_key - #2) login and get new session key + #2) get old search state + search_state = None + if 'search_state' in request.session: + search_state = request.session['search_state'] + + #3) login and get new session key _login(request,user) - #3) send signal with old session key as argument + #4) transfer search_state to new session if found + if search_state: + search_state.set_logged_in() + request.session['search_state'] = search_state + #5) send signal with old session key as argument logging.debug('logged in user %s with session key %s' % (user.username, session_key)) user_logged_in.send(user=user,session_key=session_key,sender=None) +#todo: uncouple this from forum def logout(request): from django.contrib.auth import logout as _logout#for login I've added wrapper below - called login + if 'search_state' in request.session: + request.session['search_state'].set_logged_out() + request.session.modified = True _logout(request) if settings.USE_EXTERNAL_LEGACY_LOGIN == True: EXTERNAL_LOGIN_APP.api.logout(request) |