Commit 165539ab by Dányi Bence

webui: validate ssh key

parent 899decd8
...@@ -443,11 +443,13 @@ def vm_restart(request, iid, *args, **kwargs): ...@@ -443,11 +443,13 @@ def vm_restart(request, iid, *args, **kwargs):
def key_add(request): def key_add(request):
try: try:
key=SshKey() key=SshKey()
#TODO: validate key
key.key=request.POST['key'] key.key=request.POST['key']
key.user=request.user key.user=request.user
key.full_clean()
key.save() key.save()
except: except ValidationError as e:
messages.error(request, unicode(e))
except e:
messages.error(request, _('Failed to add public key')) messages.error(request, _('Failed to add public key'))
return redirect('/') return redirect('/')
......
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