fix: 修改 修改ssh密钥时报500问题

pull/7530/head
feng626 2022-01-19 10:39:17 +08:00
parent 0b16d70c0c
commit 69d4a0a250
1 changed files with 1 additions and 0 deletions

View File

@ -43,6 +43,7 @@ class AuthSerializerMixin(serializers.ModelSerializer):
if not private_key:
return
passphrase = self.initial_data.get('passphrase')
passphrase = passphrase if passphrase else None
valid = validate_ssh_private_key(private_key, password=passphrase)
if not valid:
raise serializers.ValidationError(_("private key invalid or passphrase error"))