Skip to content

Commit

Permalink
fix: PositiveFloatField regex
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Mar 13, 2024
1 parent 99631d6 commit 5953634
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions django_form_builder/dynamic_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),]


Expand Down Expand Up @@ -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"]

0 comments on commit 5953634

Please sign in to comment.