From 595363452924237c69c137305fe65753ab6bcfee Mon Sep 17 00:00:00 2001 From: Francesco Filicetti Date: Wed, 13 Mar 2024 09:21:39 +0100 Subject: [PATCH] fix: PositiveFloatField regex --- django_form_builder/dynamic_fields.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django_form_builder/dynamic_fields.py b/django_form_builder/dynamic_fields.py index f422299..0a08143 100644 --- a/django_form_builder/dynamic_fields.py +++ b/django_form_builder/dynamic_fields.py @@ -348,7 +348,7 @@ def __init__(self, *args, **data_kwargs): def raise_error(self, name, cleaned_data, **kwargs): if not cleaned_data: return [] # Only numbers (expressions like 16e50 aren't permitted) - if not re.match('^[0-9]+\.?[0-9]?$', str(cleaned_data)): + if not re.match('^[0-9]+(.([0-9]+))?$', str(cleaned_data)): return [_("Solo numeri ammessi"),] @@ -735,11 +735,11 @@ class CustomPasswordField(CharField, BaseCustomField): field_type = _("Password") widget = forms.PasswordInput PASSWORD_SEC_REGEX = getattr( - settings, + settings, 'PASSWORD_SEC_REGEX', "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$" - ) - + ) + def raise_error(self, name, cleaned_data, **kwargs): if not re.match(self.PASSWORD_SEC_REGEX, cleaned_data): return ["Password is not secure enough, please add more entropy"]