stages/password: fix recovery link not being shown in SPA
This commit is contained in:
parent
0f169f176d
commit
cf7e7c44ff
|
@ -84,10 +84,11 @@ class PasswordStageView(ChallengeStageView):
|
||||||
)
|
)
|
||||||
recovery_flow = Flow.objects.filter(designation=FlowDesignation.RECOVERY)
|
recovery_flow = Flow.objects.filter(designation=FlowDesignation.RECOVERY)
|
||||||
if recovery_flow.exists():
|
if recovery_flow.exists():
|
||||||
challenge.initial_data["recovery_url"] = reverse(
|
recover_url = reverse(
|
||||||
"authentik_flows:flow-executor-shell",
|
"authentik_flows:flow-executor-shell",
|
||||||
kwargs={"flow_slug": recovery_flow.first().slug},
|
kwargs={"flow_slug": recovery_flow.first().slug},
|
||||||
)
|
)
|
||||||
|
challenge.initial_data["recovery_url"] = self.request.build_absolute_uri(recover_url)
|
||||||
return challenge
|
return challenge
|
||||||
|
|
||||||
def challenge_invalid(self, response: PasswordChallengeResponse) -> HttpResponse:
|
def challenge_invalid(self, response: PasswordChallengeResponse) -> HttpResponse:
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{% extends 'login/form_with_user.html' %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
{% load authentik_utils %}
|
|
||||||
|
|
||||||
{% block beneath_form %}
|
|
||||||
{% if recovery_flow %}
|
|
||||||
<a href="{% url 'authentik_api:flow-executor' flow_slug=recovery_flow.slug %}">{% trans 'Forgot password?' %}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
|
@ -56,6 +56,10 @@ export class PasswordStage extends BaseStage {
|
||||||
required="">
|
required="">
|
||||||
</ak-form-element>
|
</ak-form-element>
|
||||||
|
|
||||||
|
${this.challenge.recovery_url ?
|
||||||
|
html`<a href="${this.challenge.recovery_url}">
|
||||||
|
${gettext("Forgot password?")}</a>` : ""}
|
||||||
|
|
||||||
<div class="pf-c-form__group pf-m-action">
|
<div class="pf-c-form__group pf-m-action">
|
||||||
<button type="submit" class="pf-c-button pf-m-primary pf-m-block">
|
<button type="submit" class="pf-c-button pf-m-primary pf-m-block">
|
||||||
${gettext("Continue")}
|
${gettext("Continue")}
|
||||||
|
|
Reference in New Issue