More detailed namespace validation
Fixes namespace validation to use the proper regex for checking length, as well as showing the proper messaging if the entered namespace is invalid [Delivers #137830461]
This commit is contained in:
parent
aafcb592a6
commit
462f47924e
7 changed files with 11 additions and 14 deletions
|
@ -19,11 +19,8 @@ def create_organization(name, email, creating_user, email_required=True):
|
|||
team.add_user_to_team(creating_user, owners_team)
|
||||
|
||||
return new_org
|
||||
except InvalidUsernameException:
|
||||
msg = ('Invalid organization name: %s Organization names must consist ' +
|
||||
'solely of lower case letters, numbers, and underscores. ' +
|
||||
'[a-z0-9_]') % name
|
||||
raise InvalidOrganizationException(msg)
|
||||
except InvalidUsernameException as iue:
|
||||
raise InvalidOrganizationException(iue.message)
|
||||
|
||||
|
||||
def get_organization(name):
|
||||
|
|
|
@ -57,7 +57,7 @@ def create_user_noverify(username, email, email_required=True, prompts=tuple()):
|
|||
|
||||
(username_valid, username_issue) = validate_username(username)
|
||||
if not username_valid:
|
||||
raise InvalidUsernameException('Invalid username %s: %s' % (username, username_issue))
|
||||
raise InvalidUsernameException('Invalid namespace %s: %s' % (username, username_issue))
|
||||
|
||||
try:
|
||||
existing = User.get((User.username == username) | (User.email == email))
|
||||
|
|
Reference in a new issue