Disabled whitespace trimming in password related serializers

This commit is contained in:
Parth Verma 2018-08-24 09:03:53 +05:30
parent 95fafe5e0f
commit 1275eb0e87
2 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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