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()
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()