feat: Allow underscores and hyphens in account name

This commit is contained in:
Jérôme BECOT 2021-11-19 00:34:16 +01:00
parent 302e793665
commit e33822fa45
3 changed files with 9 additions and 9 deletions

View file

@ -35,7 +35,7 @@ class Account(db.Model):
if self.name is not None:
self.name = ''.join(c for c in self.name.lower()
if c in "abcdefghijklmnopqrstuvwxyz0123456789")
if c in "abcdefghijklmnopqrstuvwxyz0123456789_-")
def __repr__(self):
return '<Account {0}r>'.format(self.name)

View file

@ -1089,7 +1089,7 @@ def create_group_to_account_mapping():
def handle_account(account_name, account_description=""):
clean_name = ''.join(c for c in account_name.lower()
if c in "abcdefghijklmnopqrstuvwxyz0123456789")
if c in "abcdefghijklmnopqrstuvwxyz0123456789_-")
if len(clean_name) > Account.name.type.length:
current_app.logger.error(
"Account name {0} too long. Truncated.".format(clean_name))

View file

@ -49,7 +49,7 @@
<span class="fa fa-cog form-control-feedback"></span>
{% if invalid_accountname %}
<span class="help-block">Cannot be blank and must only contain alphanumeric
characters.</span>
characters, hyphens or underscores.</span>
{% elif duplicate_accountname %}
<span class="help-block">Account name already in use.</span>
{% endif %}
@ -112,8 +112,8 @@
</p>
<p>Fill in all the fields to the in the form to the left.</p>
<p>
<strong>Name</strong> is an account identifier. It will be stored as all lowercase letters (no
spaces, special characters etc).<br />
<strong>Name</strong> is an account identifier. It will be lowercased and can contain alphanumeric
characters, hyphens and underscores (no space or other special character is allowed).<br />
<strong>Description</strong> is a user friendly name for this account.<br />
<strong>Contact person</strong> is the name of a contact person at the account.<br />
<strong>Mail Address</strong> is an e-mail address for the contact person.