File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed
Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -27,22 +27,15 @@ class PasswordChangeView(generics.CreateAPIView):
2727 @extend_schema (
2828 operation_id = 'auth_change_password' ,
2929 responses = {
30- 200 : PasswordChangeSerializer ,
30+ 204 : PasswordChangeSerializer ,
3131 }
3232 )
3333 def post (self , request , format = None ):
3434 user = request .user
3535 serializer = self .serializer_class (data = request .data )
3636
37- if serializer .is_valid ():
37+ if serializer .is_valid (raise_exception = True ):
3838 user .set_password (serializer .validated_data ['password' ])
3939 user .save ()
4040
41- content = {'success' : 'Password changed.' }
42- return Response (content , status = status .HTTP_200_OK )
43-
44- else :
45- return Response (
46- serializer .errors ,
47- status = status .HTTP_400_BAD_REQUEST
48- )
41+ return Response (status = status .HTTP_204_NO_CONTENT )
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ stages:
5252 json :
5353 password : newpassword
5454 response :
55- status_code : 200
55+ status_code : 204
5656 - name : Check password has changed
5757 request :
5858 url : " {api_live_url}/auth/token/"
You can’t perform that action at this time.
0 commit comments