Do not allow comma in SSH key name
This commit is contained in:
parent
c9c91b1ecb
commit
0104a804c2
1 changed files with 5 additions and 1 deletions
|
@ -1,8 +1,8 @@
|
|||
import datetime
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
import tempfile
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate
|
||||
|
@ -214,6 +214,10 @@ class UserHostingKeyForm(forms.ModelForm):
|
|||
return openssh_pubkey_str
|
||||
|
||||
def clean_name(self):
|
||||
INVALID_NAME_MESSAGE = _("Comma not accepted in the name of the key")
|
||||
if "," in self.data.get('name'):
|
||||
logger.debug(INVALID_NAME_MESSAGE)
|
||||
raise forms.ValidationError(INVALID_NAME_MESSAGE)
|
||||
return self.data.get('name')
|
||||
|
||||
def clean_user(self):
|
||||
|
|
Loading…
Reference in a new issue