From f05f440c78d1ab676718c655537bb7f7a6a1e4cd Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 7 May 2023 20:40:11 +0200 Subject: [PATCH] stages/email: don't require pending user Signed-off-by: Jens Langhammer --- authentik/stages/email/stage.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/authentik/stages/email/stage.py b/authentik/stages/email/stage.py index f116f7de0..6cf395aa9 100644 --- a/authentik/stages/email/stage.py +++ b/authentik/stages/email/stage.py @@ -114,9 +114,10 @@ class EmailStageView(ChallengeStageView): user.is_active = True user.save() return self.executor.stage_ok() - if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context: - self.logger.debug("No pending user") - messages.error(self.request, _("No pending user.")) + if not user.is_authenticated: + # We'll only get here if there's no user in the flow plan context + # and no authenticated user either + self.logger.debug("Unauthenticated user", user=user) return self.executor.stage_invalid() # Check if we've already sent the initial e-mail if PLAN_CONTEXT_EMAIL_SENT not in self.executor.plan.context: