From ce7aae16c978be6c131bdd2895b95e4d60993dbd Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 1 Mar 2021 17:17:44 +0100 Subject: [PATCH] stages/password: fix ?next param for password change --- .../stages/password/user-settings-card.html | 2 +- authentik/stages/password/views.py | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/authentik/stages/password/templates/stages/password/user-settings-card.html b/authentik/stages/password/templates/stages/password/user-settings-card.html index 73285792a..48fbfc72a 100644 --- a/authentik/stages/password/templates/stages/password/user-settings-card.html +++ b/authentik/stages/password/templates/stages/password/user-settings-card.html @@ -9,7 +9,7 @@ {% trans 'Reset your password' %}
- + {% trans 'Change password' %}
diff --git a/authentik/stages/password/views.py b/authentik/stages/password/views.py index 1a4624719..b374a87e1 100644 --- a/authentik/stages/password/views.py +++ b/authentik/stages/password/views.py @@ -2,11 +2,10 @@ from typing import Any from django.contrib.auth.mixins import LoginRequiredMixin -from django.urls import reverse -from django.utils.http import urlencode +from django.shortcuts import get_object_or_404 from django.views.generic import TemplateView -from authentik.flows.views import NEXT_ARG_NAME +from authentik.stages.password.models import PasswordStage class UserSettingsCardView(LoginRequiredMixin, TemplateView): @@ -15,12 +14,7 @@ class UserSettingsCardView(LoginRequiredMixin, TemplateView): template_name = "stages/password/user-settings-card.html" def get_context_data(self, **kwargs: Any) -> dict[str, Any]: - base_url = reverse( - "authentik_flows:configure", - kwargs={"stage_uuid": self.kwargs["stage_uuid"]}, - ) - args = urlencode({NEXT_ARG_NAME: reverse("authentik_core:user-settings")}) - + stage = get_object_or_404(PasswordStage, pk=self.kwargs["stage_uuid"]) kwargs = super().get_context_data(**kwargs) - kwargs["url"] = f"{base_url}?{args}" + kwargs["stage"] = stage return kwargs