diff options
| author | Sébastien Piquemal | 2012-02-23 22:47:45 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-23 22:47:45 +0200 |
| commit | afd490238a38c5445013f030547b1019f484f0bc (patch) | |
| tree | d53ea67eae108c7c1d45aa52bb3f209155926349 /djangorestframework/authentication.py | |
| parent | 9da1ae81dc9a056db94ea07f35478ed003fea598 (diff) | |
| download | django-rest-framework-afd490238a38c5445013f030547b1019f484f0bc.tar.bz2 | |
authentication refactor : request.user + tests pass
Diffstat (limited to 'djangorestframework/authentication.py')
| -rw-r--r-- | djangorestframework/authentication.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/djangorestframework/authentication.py b/djangorestframework/authentication.py index e326c15a..00a61e3d 100644 --- a/djangorestframework/authentication.py +++ b/djangorestframework/authentication.py @@ -88,13 +88,14 @@ class UserLoggedInAuthentication(BaseAuthentication): Otherwise returns :const:`None`. """ request.DATA # Make sure our generic parsing runs first + user = getattr(request.request, 'user', None) - if getattr(request, 'user', None) and request.user.is_active: + if user and user.is_active: # Enforce CSRF validation for session based authentication. resp = CsrfViewMiddleware().process_view(request, None, (), {}) if resp is None: # csrf passed - return request.user + return user return None |
