Cycle or unset the webhook key if the webhook service changes

Also, tests.
This commit is contained in:
Jeff Bradberry
2019-08-22 14:17:30 -04:00
parent d4b20b7340
commit 82a0dc0024
5 changed files with 66 additions and 11 deletions

View File

@@ -38,6 +38,7 @@ class WebhookKeyView(GenericAPIView):
def post(self, request, *args, **kwargs):
obj = self.get_object()
obj.rotate_webhook_key()
obj.save(update_fields=['webhook_key'])
return Response({'webhook_key': obj.webhook_key}, status=status.HTTP_201_CREATED)