1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

accounts: add public key check

This commit is contained in:
Ing. Jan KRCMAR 2018-07-26 11:33:12 +02:00
parent 19489cb08e
commit 9f7ec62226

View file

@ -54,6 +54,9 @@ def profile(request):
if keypublic == key.keypublic: if keypublic == key.keypublic:
msg = _("Public key already exist") msg = _("Public key already exist")
error_messages.append(msg) error_messages.append(msg)
if '\n' in keypublic or '\r' in keypublic:
msg = _("Invalid characters in public key")
error_messages.append(msg)
if not error_messages: if not error_messages:
addkeypublic = UserSSHKey(user_id=request.user.id, keyname=keyname, keypublic=keypublic) addkeypublic = UserSSHKey(user_id=request.user.id, keyname=keyname, keypublic=keypublic)
addkeypublic.save() addkeypublic.save()