Added clean method for ldap_search_filter.

see #1872
This commit is contained in:
Antoine Nguyen
2020-04-07 17:31:42 +02:00
parent cd0da40593
commit 8e5dfd67ad
+8
View File
@@ -486,6 +486,14 @@ class GeneralParametersForm(param_forms.AdminParametersForm):
raise forms.ValidationError(_("Invalid syntax"))
return tpl
def clean_ldap_search_filter(self):
ldap_filter = self.cleaned_data["ldap_search_filter"]
try:
ldap_filter % {"user": "toto"}
except (KeyError, ValueError, TypeError):
raise forms.ValidationError(_("Invalid syntax"))
return ldap_filter
def clean_rounds_number(self):
value = self.cleaned_data["rounds_number"]
if value < 1000 or value > 999999999: