perf: 用户添加密码 设置是否已存在 (#10138)

Co-authored-by: feng <1304903146@qq.com>
pull/10141/head
fit2bot 2 years ago committed by GitHub
parent 7c1e92c787
commit 47d0882090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,10 +58,11 @@ class UserUpdatePasswordSerializer(serializers.ModelSerializer):
class UserUpdateSecretKeySerializer(serializers.ModelSerializer):
new_secret_key = EncryptedField(required=True, max_length=128)
new_secret_key_again = EncryptedField(required=True, max_length=128)
has_secret_key = serializers.BooleanField(read_only=True, source='secret_key')
class Meta:
model = User
fields = ['new_secret_key', 'new_secret_key_again']
fields = ['has_secret_key', 'new_secret_key', 'new_secret_key_again']
def validate(self, values):
new_secret_key = values.get('new_secret_key', '')

Loading…
Cancel
Save