From 1275eb0e87202e5439c3da9ceabf5dd901271ef9 Mon Sep 17 00:00:00 2001 From: Parth Verma Date: Fri, 24 Aug 2018 09:03:53 +0530 Subject: [PATCH] Disabled whitespace trimming in password related serializers --- rest_auth/registration/serializers.py | 4 ++-- rest_auth/serializers.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 4f99c18..1e12b13 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -170,8 +170,8 @@ class RegisterSerializer(serializers.Serializer): required=allauth_settings.USERNAME_REQUIRED ) email = serializers.EmailField(required=allauth_settings.EMAIL_REQUIRED) - password1 = serializers.CharField(write_only=True) - password2 = serializers.CharField(write_only=True) + password1 = serializers.CharField(write_only=True,trim_whitespace=False) + password2 = serializers.CharField(write_only=True,trim_whitespace=False) def validate_username(self, username): username = get_adapter().clean_username(username) diff --git a/rest_auth/serializers.py b/rest_auth/serializers.py index 45729b2..bd32316 100644 --- a/rest_auth/serializers.py +++ b/rest_auth/serializers.py @@ -19,7 +19,7 @@ UserModel = get_user_model() class LoginSerializer(serializers.Serializer): username = serializers.CharField(required=False, allow_blank=True) email = serializers.EmailField(required=False, allow_blank=True) - password = serializers.CharField(style={'input_type': 'password'}) + password = serializers.CharField(style={'input_type': 'password'},trim_whitespace=False) def _validate_email(self, email, password): user = None @@ -187,8 +187,8 @@ class PasswordResetConfirmSerializer(serializers.Serializer): """ Serializer for requesting a password reset e-mail. """ - new_password1 = serializers.CharField(max_length=128) - new_password2 = serializers.CharField(max_length=128) + new_password1 = serializers.CharField(max_length=128,trim_whitespace=False) + new_password2 = serializers.CharField(max_length=128,trim_whitespace=False) uid = serializers.CharField() token = serializers.CharField() @@ -224,9 +224,9 @@ class PasswordResetConfirmSerializer(serializers.Serializer): class PasswordChangeSerializer(serializers.Serializer): - old_password = serializers.CharField(max_length=128) - new_password1 = serializers.CharField(max_length=128) - new_password2 = serializers.CharField(max_length=128) + old_password = serializers.CharField(max_length=128,trim_whitespace=False) + new_password1 = serializers.CharField(max_length=128,trim_whitespace=False) + new_password2 = serializers.CharField(max_length=128,trim_whitespace=False) set_password_form_class = SetPasswordForm