stages/invitation: don't throw 404 error in stage

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-03 00:07:13 +01:00
parent f978575293
commit f51515f3de
1 changed files with 6 additions and 1 deletions

View File

@ -50,7 +50,12 @@ class InvitationStageView(StageView):
return self.executor.stage_ok()
return self.executor.stage_invalid()
invite: Invitation = get_object_or_404(Invitation, pk=token)
invite: Invitation = Invitation.objects.filter(pk=token).first()
if not invite:
LOGGER.debug("invalid invitation", token=token)
if stage.continue_flow_without_invitation:
return self.executor.stage_ok()
return self.executor.stage_invalid()
self.executor.plan.context[INVITATION_IN_EFFECT] = True
self.executor.plan.context[INVITATION] = invite