From cf7e7c44ff15f25bf40136625259d5813fd101df Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 25 Feb 2021 15:09:48 +0100 Subject: [PATCH] stages/password: fix recovery link not being shown in SPA --- authentik/stages/password/stage.py | 3 ++- .../password/templates/stages/password/flow-form.html | 10 ---------- web/src/elements/stages/password/PasswordStage.ts | 4 ++++ 3 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 authentik/stages/password/templates/stages/password/flow-form.html diff --git a/authentik/stages/password/stage.py b/authentik/stages/password/stage.py index 19f39b46c..f9afbf6bb 100644 --- a/authentik/stages/password/stage.py +++ b/authentik/stages/password/stage.py @@ -84,10 +84,11 @@ class PasswordStageView(ChallengeStageView): ) recovery_flow = Flow.objects.filter(designation=FlowDesignation.RECOVERY) if recovery_flow.exists(): - challenge.initial_data["recovery_url"] = reverse( + recover_url = reverse( "authentik_flows:flow-executor-shell", kwargs={"flow_slug": recovery_flow.first().slug}, ) + challenge.initial_data["recovery_url"] = self.request.build_absolute_uri(recover_url) return challenge def challenge_invalid(self, response: PasswordChallengeResponse) -> HttpResponse: diff --git a/authentik/stages/password/templates/stages/password/flow-form.html b/authentik/stages/password/templates/stages/password/flow-form.html deleted file mode 100644 index 21ea7e476..000000000 --- a/authentik/stages/password/templates/stages/password/flow-form.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'login/form_with_user.html' %} - -{% load i18n %} -{% load authentik_utils %} - -{% block beneath_form %} -{% if recovery_flow %} -{% trans 'Forgot password?' %} -{% endif %} -{% endblock %} diff --git a/web/src/elements/stages/password/PasswordStage.ts b/web/src/elements/stages/password/PasswordStage.ts index 4fba2e00b..8b6045d72 100644 --- a/web/src/elements/stages/password/PasswordStage.ts +++ b/web/src/elements/stages/password/PasswordStage.ts @@ -56,6 +56,10 @@ export class PasswordStage extends BaseStage { required=""> + ${this.challenge.recovery_url ? + html` + ${gettext("Forgot password?")}` : ""} +