Skip to content

Commit

Permalink
Use request.data instead of trying to parse json
Browse files Browse the repository at this point in the history
  • Loading branch information
ira committed Jul 6, 2017
1 parent 9b3878d commit be0e74c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
class LoginView(views.APIView):

def post(self, request, format=None):
data = json.loads(request.body.decode('utf-8', errors='replace'))
username = data.get('username', None)
password = data.get('password', None)
username = request.data.get('username', None)
password = request.data.get('password', None)
account = authenticate(username=username, password=password)
if account is not None:
if account.is_active:
Expand Down

0 comments on commit be0e74c

Please sign in to comment.