slight cleanup

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2025-03-06 17:04:16 +00:00
parent 7f5cfdc3d3
commit 4aa497346d
3 changed files with 6 additions and 9 deletions

View File

@ -145,9 +145,8 @@ class EmailStageView(ChallengeStageView):
user.save() user.save()
return self.executor.stage_ok() return self.executor.stage_ok()
if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context: if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context:
message = _("No pending user") self.logger.warning("No pending user")
self.logger.debug(message) return self.executor.stage_invalid(_("No pending user"))
return self.executor.stage_invalid(message)
# Check if we've already sent the initial e-mail # Check if we've already sent the initial e-mail
if PLAN_CONTEXT_EMAIL_SENT not in self.executor.plan.context: if PLAN_CONTEXT_EMAIL_SENT not in self.executor.plan.context:
try: try:

View File

@ -15,9 +15,8 @@ class UserDeleteStageView(StageView):
"""Delete currently pending user""" """Delete currently pending user"""
user = self.get_pending_user() user = self.get_pending_user()
if not user.is_authenticated: if not user.is_authenticated:
message = _("No Pending User.") self.logger.warning("No authenticated user")
self.logger.debug(message) return self.executor.stage_invalid(_("No authenticated User."))
return self.executor.stage_invalid(message)
logout(self.request) logout(self.request)
user.delete() user.delete()
self.logger.debug("Deleted user", user=user) self.logger.debug("Deleted user", user=user)

View File

@ -80,9 +80,8 @@ class UserLoginStageView(ChallengeStageView):
def do_login(self, request: HttpRequest, remember: bool = False) -> HttpResponse: def do_login(self, request: HttpRequest, remember: bool = False) -> HttpResponse:
"""Attach the currently pending user to the current session""" """Attach the currently pending user to the current session"""
if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context: if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context:
message = _("No Pending user to login.") self.logger.warning("No pending user to login")
self.logger.debug(message) return self.executor.stage_invalid(_("No Pending user to login."))
return self.executor.stage_invalid(message)
backend = self.executor.plan.context.get( backend = self.executor.plan.context.get(
PLAN_CONTEXT_AUTHENTICATION_BACKEND, BACKEND_INBUILT PLAN_CONTEXT_AUTHENTICATION_BACKEND, BACKEND_INBUILT
) )