flows: allow blank on WithUserInfo
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
58a4b20297
commit
6f3eb4c068
|
@ -61,7 +61,7 @@ class ShellChallenge(Challenge):
|
|||
class WithUserInfoChallenge(Challenge):
|
||||
"""Challenge base which shows some user info"""
|
||||
|
||||
pending_user = CharField()
|
||||
pending_user = CharField(allow_blank=True)
|
||||
pending_user_avatar = CharField()
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ from django.http.response import HttpResponseBadRequest
|
|||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from structlog.stdlib import get_logger
|
||||
|
@ -134,10 +133,8 @@ class InitiateView(View):
|
|||
return bad_request_message(request, str(exc))
|
||||
injected_stages = []
|
||||
plan_kwargs = {
|
||||
PLAN_CONTEXT_TITLE: _("Redirecting to %(app)s..." % {"app": source.name}),
|
||||
PLAN_CONTEXT_CONSENT_TITLE: _(
|
||||
"Redirecting to %(app)s..." % {"app": source.name}
|
||||
),
|
||||
PLAN_CONTEXT_TITLE: f"Redirecting to {source.name}...",
|
||||
PLAN_CONTEXT_CONSENT_TITLE: f"Redirecting to {source.name}...",
|
||||
PLAN_CONTEXT_ATTRS: {
|
||||
"SAMLRequest": saml_request,
|
||||
"RelayState": relay_state,
|
||||
|
|
|
@ -40,23 +40,19 @@ class ConsentStageView(ChallengeStageView):
|
|||
response_class = ConsentChallengeResponse
|
||||
|
||||
def get_challenge(self) -> Challenge:
|
||||
challenge = ConsentChallenge(
|
||||
data={
|
||||
"type": ChallengeTypes.NATIVE.value,
|
||||
}
|
||||
)
|
||||
data = {
|
||||
"type": ChallengeTypes.NATIVE.value,
|
||||
"permissions": self.executor.plan.context.get(
|
||||
PLAN_CONTEXT_CONSENT_PERMISSIONS, []
|
||||
),
|
||||
}
|
||||
if PLAN_CONTEXT_CONSENT_TITLE in self.executor.plan.context:
|
||||
challenge.initial_data["title"] = self.executor.plan.context[
|
||||
PLAN_CONTEXT_CONSENT_TITLE
|
||||
]
|
||||
data["title"] = self.executor.plan.context[PLAN_CONTEXT_CONSENT_TITLE]
|
||||
if PLAN_CONTEXT_CONSENT_HEADER in self.executor.plan.context:
|
||||
challenge.initial_data["header_text"] = self.executor.plan.context[
|
||||
data["header_text"] = self.executor.plan.context[
|
||||
PLAN_CONTEXT_CONSENT_HEADER
|
||||
]
|
||||
if PLAN_CONTEXT_CONSENT_PERMISSIONS in self.executor.plan.context:
|
||||
challenge.initial_data["permissions"] = self.executor.plan.context[
|
||||
PLAN_CONTEXT_CONSENT_PERMISSIONS
|
||||
]
|
||||
challenge = ConsentChallenge(data=data)
|
||||
return challenge
|
||||
|
||||
def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
|
||||
|
|
Reference in New Issue