stages/password: fix ?next param for password change
This commit is contained in:
parent
fd9ba97479
commit
ce7aae16c9
|
@ -9,7 +9,7 @@
|
||||||
{% trans 'Reset your password' %}
|
{% trans 'Reset your password' %}
|
||||||
</div>
|
</div>
|
||||||
<div class="pf-c-card__body">
|
<div class="pf-c-card__body">
|
||||||
<a class="pf-c-button pf-m-primary ak-root-link" href="{{ url }}">
|
<a class="pf-c-button pf-m-primary ak-root-link" href="{% url 'authentik_flows:configure' stage_uuid=stage.stage_uuid %}?next=/%23{% url 'authentik_core:user-settings' %}">
|
||||||
{% trans 'Change password' %}
|
{% trans 'Change password' %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.urls import reverse
|
from django.shortcuts import get_object_or_404
|
||||||
from django.utils.http import urlencode
|
|
||||||
from django.views.generic import TemplateView
|
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):
|
class UserSettingsCardView(LoginRequiredMixin, TemplateView):
|
||||||
|
@ -15,12 +14,7 @@ class UserSettingsCardView(LoginRequiredMixin, TemplateView):
|
||||||
template_name = "stages/password/user-settings-card.html"
|
template_name = "stages/password/user-settings-card.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||||
base_url = reverse(
|
stage = get_object_or_404(PasswordStage, pk=self.kwargs["stage_uuid"])
|
||||||
"authentik_flows:configure",
|
|
||||||
kwargs={"stage_uuid": self.kwargs["stage_uuid"]},
|
|
||||||
)
|
|
||||||
args = urlencode({NEXT_ARG_NAME: reverse("authentik_core:user-settings")})
|
|
||||||
|
|
||||||
kwargs = super().get_context_data(**kwargs)
|
kwargs = super().get_context_data(**kwargs)
|
||||||
kwargs["url"] = f"{base_url}?{args}"
|
kwargs["stage"] = stage
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
Reference in New Issue