feat(api): password supports regular check

This commit is contained in:
pycook
2024-01-12 16:56:10 +08:00
parent 67081ef005
commit 9bc0ab6009
2 changed files with 10 additions and 4 deletions

View File

@@ -118,7 +118,7 @@ class AttributeValueManager(object):
return abort(400, ErrFormat.attribute_value_required.format(attr.alias))
@staticmethod
def _check_re(expr, value):
def check_re(expr, value):
if not re.compile(expr).match(str(value)):
return abort(400, ErrFormat.attribute_value_invalid.format(value))
@@ -136,7 +136,7 @@ class AttributeValueManager(object):
v = None
if attr.re_check and value:
self._check_re(attr.re_check, value)
self.check_re(attr.re_check, value)
return v