From d5d8641b3725a88c2d1100eca2ccda34ee336ba1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 10 Nov 2021 16:47:56 +0100 Subject: [PATCH] stages/*: disable trim_whitespace on important fields closes #1765 Signed-off-by: Jens Langhammer --- authentik/stages/password/stage.py | 2 +- authentik/stages/prompt/models.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/authentik/stages/password/stage.py b/authentik/stages/password/stage.py index fddde51b6..ddcfe84dc 100644 --- a/authentik/stages/password/stage.py +++ b/authentik/stages/password/stage.py @@ -69,7 +69,7 @@ class PasswordChallenge(WithUserInfoChallenge): class PasswordChallengeResponse(ChallengeResponse): """Password challenge response""" - password = CharField() + password = CharField(trim_whitespace=False) component = CharField(default="ak-stage-password") diff --git a/authentik/stages/prompt/models.py b/authentik/stages/prompt/models.py index 60bde42c6..d5ca18bff 100644 --- a/authentik/stages/prompt/models.py +++ b/authentik/stages/prompt/models.py @@ -85,7 +85,8 @@ class Prompt(SerializerModel): kwargs = { "required": self.required, } - + if self.type == FieldTypes.TEXT: + kwargs["trim_whitespace"] = False if self.type == FieldTypes.TEXT_READ_ONLY: field_class = ReadOnlyField if self.type == FieldTypes.EMAIL: