Skip to content

Commit

Permalink
Merge fd1c3f8 into 64cb624
Browse files Browse the repository at this point in the history
  • Loading branch information
RutaleIvanPaul committed Aug 6, 2018
2 parents 64cb624 + fd1c3f8 commit 2dfe4a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ db.sqlite3

#DS STORE
.DS_Store

#Images folder
profile_image/
5 changes: 4 additions & 1 deletion authors/apps/profiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from rest_framework.response import Response
from rest_framework import status
from rest_framework.permissions import AllowAny, IsAuthenticated
from authors.settings.base import SECRET_KEY
from authors.apps.authentication.backends import JWTAuthentication
import json
from authors.apps.profiles.serializers import (
UpdateSerializer,ProfileSerializer
Expand All @@ -21,12 +23,13 @@ def check_empty_input(self,dictionary_input):


def put(self,request):
jwt = JWTAuthentication()
if not self.check_empty_input(request.data):
return Response(data={
"error":"One of the input fields is empty."
},status=status.HTTP_400_BAD_REQUEST)

email = request.data.get('email')
email = jwt.authenticate(request)[0]
user = User.objects.filter(email=email)
updated_user = self.serializer_class().update(user[0], request.data)
return Response(data=self.serializer_class(updated_user).data,status=status.HTTP_200_OK)
Expand Down
1 change: 1 addition & 0 deletions authors/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
'authors.apps.authentication.backends.JWTAuthentication',
),
}

2 changes: 1 addition & 1 deletion authors/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
path('api/', include('authors.apps.articles.urls')),

path('api/', include('authors.apps.authentication.urls', namespace='authentication')),
path('api/profiles', include('authors.apps.profiles.urls', namespace='profiles')),
path('api/profiles/', include('authors.apps.profiles.urls', namespace='profiles')),
]

0 comments on commit 2dfe4a6

Please sign in to comment.