stages/password: fix recovery link not being shown in SPA

This commit is contained in:
Jens Langhammer 2021-02-25 15:09:48 +01:00
parent 0f169f176d
commit cf7e7c44ff
3 changed files with 6 additions and 11 deletions

View File

@ -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:

View File

@ -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 %}

View File

@ -56,6 +56,10 @@ export class PasswordStage extends BaseStage {
required="">
</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">
<button type="submit" class="pf-c-button pf-m-primary pf-m-block">
${gettext("Continue")}