mirror of https://github.com/jumpserver/jumpserver
Merge pull request #3660 from jumpserver/dev_auth
[Update] 修复用户更新页面会清空用户public_key的问题pull/3661/head
commit
b227d9cdc1
|
@ -74,8 +74,17 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
|
||||||
attrs['password_raw'] = password
|
attrs['password_raw'] = password
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clean_auth_fields(attrs):
|
||||||
|
for field in ('password', 'public_key'):
|
||||||
|
value = attrs.get(field)
|
||||||
|
if not value:
|
||||||
|
attrs.pop(field, None)
|
||||||
|
return attrs
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
attrs = self.change_password_to_raw(attrs)
|
attrs = self.change_password_to_raw(attrs)
|
||||||
|
attrs = self.clean_auth_fields(attrs)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue