Skip to content

Commit

Permalink
Cleaning up session if no valid access_token key has been found
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani committed Feb 5, 2019
1 parent 25f20e3 commit 6bd835a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion geonode/base/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ def get_session_token(session):
def get_token_object_from_session(session):
if 'access_token' in session:
try:
return AccessToken.objects.get(token=str(session['access_token']))
return AccessToken.objects.get(token=get_session_token(session))
except BaseException:
del session['access_token']
session.modified = True
return None
return None

Expand Down

1 comment on commit 6bd835a

@giohappy
Copy link
Contributor

@giohappy giohappy commented on 6bd835a Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a session.modified = True never hurts, but it shouldn't be required. The docs say that it's only required in case of changes to nested keys.

Please sign in to comment.