Merge pull request #7530 from jumpserver/pr@dev@ssh_passphrase_bug

fix: 修改 修改ssh密钥时报500问题
pull/7533/head
feng626 2022-01-19 11:11:49 +08:00 committed by GitHub
commit 2beec1a03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"))