mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-16 05:14:33 +00:00
Merge pull request #3660 from jumpserver/dev_auth
[Update] 修复用户更新页面会清空用户public_key的问题
This commit is contained in:
commit
b227d9cdc1
@ -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