Fix cookie auth to work with oauth token auth. Make sure user loading is truly deferred to save DB connections.

This commit is contained in:
jakedt 2014-03-17 12:01:13 -04:00
parent e759066ae0
commit 5bb4008880
6 changed files with 65 additions and 26 deletions

View file

@ -111,11 +111,8 @@ class User(ApiResource):
@nickname('getLoggedInUser')
def get(self):
""" Get user information for the authenticated user. """
if get_authenticated_user() is None:
return {'anonymous': True}
user = get_authenticated_user()
if not user or user.organization:
if user is None or user.organization:
return {'anonymous': True}
return user_view(user)