mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-31 22:36:37 +00:00
[Update] 修复用户更新页面会清空用户public_key的问题
This commit is contained in:
parent
13a042bc0f
commit
da6a0c286d
@ -74,8 +74,17 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
|
||||
attrs['password_raw'] = password
|
||||
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):
|
||||
attrs = self.change_password_to_raw(attrs)
|
||||
attrs = self.clean_auth_fields(attrs)
|
||||
return attrs
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user