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:
parent
ccf75e7104
commit
2a9900d2eb
@ -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 "-"')
|
||||
)
|
||||
|
@ -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 "-"')
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user