mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 09:06:40 +03:00
Changed PasswordChangeSerializer to not include old_password when user has no usable password
This commit is contained in:
parent
9d1f65eedc
commit
b002ee3d4b
|
@ -239,12 +239,12 @@ class PasswordChangeSerializer(serializers.Serializer):
|
|||
)
|
||||
super(PasswordChangeSerializer, self).__init__(*args, **kwargs)
|
||||
|
||||
if not self.old_password_field_enabled:
|
||||
self.fields.pop('old_password')
|
||||
|
||||
self.request = self.context.get('request')
|
||||
self.user = getattr(self.request, 'user', None)
|
||||
|
||||
if not self.old_password_field_enabled or not self.user.has_usable_password():
|
||||
self.fields.pop('old_password')
|
||||
|
||||
def validate_old_password(self, value):
|
||||
invalid_password_conditions = (
|
||||
self.old_password_field_enabled,
|
||||
|
|
Loading…
Reference in New Issue
Block a user