1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-23 17:34:17 +03:00

Fixed empty label not being saved on re match enforcement :)

This commit is contained in:
Adolfo Gómez García 2022-12-13 15:03:29 +01:00
parent ccf75e7104
commit 2a9900d2eb
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 2 additions and 2 deletions

View File

@ -228,7 +228,7 @@ class Authenticators(ModelHandler):
fields['mfa_id'] = None
fields['small_name'] = fields['small_name'].strip().replace(' ', '-')
# And ensure small_name chars are valid [ a-zA-Z0-9:-]+
if not re.match(r'^[a-zA-Z0-9:-]+$', fields['small_name']):
if fields['small-name'] and not re.match(r'^[a-zA-Z0-9:-]+$', fields['small_name']):
raise self.invalidRequestException(
_('Label must contain only letters, numbers, ":" and "-"')
)

View File

@ -203,7 +203,7 @@ class Transports(ModelHandler):
# If label has spaces, replace them with underscores
fields['label'] = fields['label'].strip().replace(' ', '-')
# And ensure small_name chars are valid [ a-zA-Z0-9:-]+
if not re.match(r'^[a-zA-Z0-9:-]+$', fields['label']):
if fields['label'] and not re.match(r'^[a-zA-Z0-9:-]+$', fields['label']):
raise self.invalidRequestException(
_('Label must contain only letters, numbers, ":" and "-"')
)