diff --git a/authentik/sources/oauth/views/callback.py b/authentik/sources/oauth/views/callback.py index 6126671aa8ff..7b561014f94d 100644 --- a/authentik/sources/oauth/views/callback.py +++ b/authentik/sources/oauth/views/callback.py @@ -96,6 +96,7 @@ def get_user_id(self, info: dict[str, Any]) -> str | None: def handle_login_failure(self, reason: str) -> HttpResponse: "Message user and redirect on error." LOGGER.warning("Authentication Failure", reason=reason) + # TODO(risson): figure out how to avoid this messages.error( self.request, _( diff --git a/authentik/stages/email/stage.py b/authentik/stages/email/stage.py index 062dae62ef43..2ed5d6477ed6 100644 --- a/authentik/stages/email/stage.py +++ b/authentik/stages/email/stage.py @@ -139,15 +139,16 @@ def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: if restore_token.user != user: self.logger.warning("Flow token for non-matching user, denying request") return self.executor.stage_invalid() + # TODO(risson): figure out how to avoid this messages.success(request, _("Successfully verified Email.")) if self.executor.current_stage.activate_user_on_success: 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.")) - return self.executor.stage_invalid() + message = _("No pending user") + self.logger.debug(message) + return self.executor.stage_invalid(message) # Check if we've already sent the initial e-mail if PLAN_CONTEXT_EMAIL_SENT not in self.executor.plan.context: try: @@ -171,9 +172,11 @@ def challenge_valid(self, response: ChallengeResponse) -> HttpResponse: def challenge_invalid(self, response: ChallengeResponse) -> HttpResponse: if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context: + # TODO(risson): figure out how to avoid this messages.error(self.request, _("No pending user.")) return super().challenge_invalid(response) self.send_email() + # TODO(risson): figure out how to avoid this messages.success(self.request, _("Email Successfully sent.")) # We can't call stage_ok yet, as we're still waiting # for the user to click the link in the email diff --git a/authentik/stages/prompt/stage.py b/authentik/stages/prompt/stage.py index 5f43e11ebffb..19ba44f1d2cd 100644 --- a/authentik/stages/prompt/stage.py +++ b/authentik/stages/prompt/stage.py @@ -150,6 +150,7 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]: raise ValidationError(list(result.messages)) else: for msg in result.messages: + # TODO(risson): figure out how to avoid this add_message(self.request, INFO, msg) return attrs diff --git a/authentik/stages/user_delete/stage.py b/authentik/stages/user_delete/stage.py index 3ea73f126833..2bcd722c152b 100644 --- a/authentik/stages/user_delete/stage.py +++ b/authentik/stages/user_delete/stage.py @@ -1,6 +1,5 @@ """Delete stage logic""" -from django.contrib import messages from django.contrib.auth import logout from django.http import HttpRequest, HttpResponse from django.utils.translation import gettext as _ @@ -17,9 +16,8 @@ def dispatch(self, request: HttpRequest) -> HttpResponse: user = self.get_pending_user() if not user.is_authenticated: message = _("No Pending User.") - messages.error(request, message) self.logger.debug(message) - return self.executor.stage_invalid() + return self.executor.stage_invalid(message) logout(self.request) user.delete() self.logger.debug("Deleted user", user=user) diff --git a/authentik/stages/user_login/stage.py b/authentik/stages/user_login/stage.py index 5f180a977c96..e420d2748b6d 100644 --- a/authentik/stages/user_login/stage.py +++ b/authentik/stages/user_login/stage.py @@ -81,9 +81,8 @@ def do_login(self, request: HttpRequest, remember: bool = False) -> HttpResponse """Attach the currently pending user to the current session""" if PLAN_CONTEXT_PENDING_USER not in self.executor.plan.context: message = _("No Pending user to login.") - messages.error(request, message) self.logger.debug(message) - return self.executor.stage_invalid() + return self.executor.stage_invalid(message) backend = self.executor.plan.context.get( PLAN_CONTEXT_AUTHENTICATION_BACKEND, BACKEND_INBUILT ) diff --git a/web/src/flow/FlowExecutor.ts b/web/src/flow/FlowExecutor.ts index 6eb2e0ed8599..87c3c1fbf4cc 100644 --- a/web/src/flow/FlowExecutor.ts +++ b/web/src/flow/FlowExecutor.ts @@ -7,7 +7,6 @@ import { import { globalAK } from "@goauthentik/common/global"; import { configureSentry } from "@goauthentik/common/sentry"; import { first } from "@goauthentik/common/utils"; -import { WebsocketClient } from "@goauthentik/common/ws"; import { Interface } from "@goauthentik/elements/Interface"; import "@goauthentik/elements/LoadingOverlay"; import "@goauthentik/elements/ak-locale-context"; @@ -83,8 +82,6 @@ export class FlowExecutor extends Interface implements StageHost { @state() flowInfo?: ContextualFlowInfo; - ws: WebsocketClient; - static get styles(): CSSResult[] { return [PFBase, PFLogin, PFDrawer, PFButton, PFTitle, PFList, PFBackgroundImage].concat(css` :host { @@ -174,7 +171,6 @@ export class FlowExecutor extends Interface implements StageHost { constructor() { super(); - this.ws = new WebsocketClient(); const inspector = new URL(window.location.toString()).searchParams.get("inspector"); if (inspector === "" || inspector === "open") { this.inspectorOpen = true; diff --git a/web/src/flow/FlowInterface.ts b/web/src/flow/FlowInterface.ts index f645023c04a6..52a57ccf6385 100644 --- a/web/src/flow/FlowInterface.ts +++ b/web/src/flow/FlowInterface.ts @@ -1,4 +1,3 @@ -import "@goauthentik/elements/messages/MessageContainer"; import "@goauthentik/flow/FlowExecutor"; // Statically import some stages to speed up load speed import "@goauthentik/flow/stages/access_denied/AccessDeniedStage";