Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Commit

Permalink
Fixed authentication for custom_rest
Browse files Browse the repository at this point in the history
  • Loading branch information
danigm committed Sep 29, 2014
1 parent 6303c52 commit 6e2b264
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions agora_site/misc/generic_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def wrap_form(self, form_class, method="POST", raw=False, anon=False):
"""
@csrf_exempt
def wrapper(request, *args, **kwargs):
if not anon:
self.is_authenticated(request)
if not anon and not request.user.is_authenticated():
self.is_authenticated(request)
try:
desired_format = self.determine_format(request)
if method == "POST" or method== "PUT":
Expand Down Expand Up @@ -200,7 +200,8 @@ def wrap_view(self, view, anon=False):
"""
def authenticated(cb):
def wrap(request, *args, **kwargs):
self.is_authenticated(request)
if not request.user.is_authenticated():
self.is_authenticated(request)
return cb(request, *args, **kwargs)
return wrap

Expand Down

0 comments on commit 6e2b264

Please sign in to comment.