Allow namespaces to be between 2 and 255 characters in length
[Delivers #137924329]
This commit is contained in:
parent
e2748fccd9
commit
7c7a07fb5a
8 changed files with 43 additions and 39 deletions
|
@ -9,8 +9,8 @@ INVALID_PASSWORD_MESSAGE = 'Invalid password, password must be at least ' + \
|
|||
'8 characters and contain no whitespace.'
|
||||
VALID_CHARACTERS = string.digits + string.lowercase
|
||||
|
||||
MIN_USERNAME_LENGTH = 4
|
||||
MAX_USERNAME_LENGTH = 30
|
||||
MIN_USERNAME_LENGTH = 2
|
||||
MAX_USERNAME_LENGTH = 255
|
||||
|
||||
VALID_LABEL_KEY_REGEX = r'^[a-z0-9](([a-z0-9]|[-.](?![.-]))*[a-z0-9])?$'
|
||||
VALID_USERNAME_REGEX = r'^([a-z0-9]+(?:[._-][a-z0-9]+)*)$'
|
||||
|
@ -63,7 +63,7 @@ def _gen_filler_chars(num_filler_chars):
|
|||
|
||||
def generate_valid_usernames(input_username):
|
||||
normalized = input_username.encode('unidecode', 'ignore').strip().lower()
|
||||
prefix = re.sub(INVALID_USERNAME_CHARACTERS, '_', normalized)[:30]
|
||||
prefix = re.sub(INVALID_USERNAME_CHARACTERS, '_', normalized)[:MAX_USERNAME_LENGTH]
|
||||
prefix = re.sub(r'_{2,}', '_', prefix)
|
||||
|
||||
if prefix.endswith('_'):
|
||||
|
|
Reference in a new issue