diff --git a/hosting/forms.py b/hosting/forms.py index 16b06fe0..576a1996 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -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):