From f978575293347d8a8c5ce67ad0805fbe3741b785 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 2 Nov 2021 23:50:12 +0100 Subject: [PATCH] stages/invitation: remove invitation from plan context after deletion Signed-off-by: Jens Langhammer --- authentik/stages/invitation/stage.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/authentik/stages/invitation/stage.py b/authentik/stages/invitation/stage.py index a68ae94bd..f65301fba 100644 --- a/authentik/stages/invitation/stage.py +++ b/authentik/stages/invitation/stage.py @@ -79,7 +79,9 @@ class InvitationFinalStageView(StageView): if not invitation: LOGGER.warning("InvitationFinalStageView stage called without invitation") return HttpResponseBadRequest - if not invitation.single_use: - return self.executor.stage_ok() - invitation.delete() + token = invitation.invite_uuid.hex + if invitation.single_use: + invitation.delete() + LOGGER.debug("Deleted invitation", token=token) + del self.executor.plan.context[INVITATION] return self.executor.stage_ok()