Commit b2f7d586 by Scott Duckworth

fix issue #1, entering blank key fails

parent 38190ed3
...@@ -60,8 +60,13 @@ class UserKey(models.Model): ...@@ -60,8 +60,13 @@ class UserKey(models.Model):
def clean_fields(self, exclude=None): def clean_fields(self, exclude=None):
if not exclude or 'key' not in exclude: if not exclude or 'key' not in exclude:
self.key = self.key.strip() self.key = self.key.strip()
if not self.key:
raise ValidationError({'key': ["This field is required."]})
def clean(self): def clean(self):
self.key = self.key.strip()
if not self.key:
return
try: try:
pubkey = pubkey_parse(self.key) pubkey = pubkey_parse(self.key)
except PublicKeyParseError as e: except PublicKeyParseError as e:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment