Merge "Allows the use of dollar sign in usernames"

This commit is contained in:
Jenkins
2017-09-12 11:15:10 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 2 deletions

View File

@@ -337,12 +337,12 @@ def validate_common_name(access):
def validate_username(access):
valid_username_re = '[\w\.\-_\`;\'\{\}\[\]\\\\]{4,255}$'
valid_username_re = '[\w\$\.\-_\`;\'\{\}\[\]\\\\]{4,255}$'
username = access
if not re.match(valid_username_re, username):
exc_str = ('Invalid user or group name. Must be 4-255 characters '
'and consist of alphanumeric characters and '
'special characters ]{.-_\'`;}[\\')
'special characters $]{.-_\'`;}[\\')
raise webob.exc.HTTPBadRequest(explanation=exc_str)

View File

@@ -257,6 +257,7 @@ class MiscFunctionsTest(test.TestCase):
@ddt.data(['ip', '1.1.1.1', False, False], ['user', 'alice', False, False],
['cert', 'alice', False, False], ['cephx', 'alice', True, False],
['user', 'alice$', False, False],
['ip', '172.24.41.0/24', False, False],
['ip', '1001::1001', False, True],
['ip', '1001::1000/120', False, True])