Exemple #1
0
 def password_reset_confirm(self, request):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = tokens.get_user_for_password_reset_token(serializer.validated_data['token'])
     user.set_password(serializer.validated_data['new_password'])
     user.save()
     return response.NoContent()
Exemple #2
0
 def password_change(self, request):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     request.user.set_password(serializer.validated_data["new_password"])
     request.user.save()
     return response.NoContent()