[Bugfix] for some commit

pull/1147/head^2
ibuler 2018-03-29 15:06:35 +08:00
parent 0c80e3e815
commit 6fae4d5dee
1 changed files with 2 additions and 4 deletions

View File

@ -16,13 +16,11 @@ class AuthSerializer(serializers.ModelSerializer):
return private_key, public_key
def save(self, **kwargs):
password = self.validated_data.pop('password') or None
private_key = self.validated_data.pop('private_key') or None
password = self.validated_data.pop('password', None) or None
private_key = self.validated_data.pop('private_key', None) or None
self.instance = super().save(**kwargs)
if password or private_key:
private_key, public_key = self.gen_keys(private_key, password)
self.instance.set_auth(password=password, private_key=private_key,
public_key=public_key)
return self.instance