users: Ban names shorter than 3 characters.

The empty string is not a reasonable name.
This commit is contained in:
Tim Abbott
2017-05-11 19:21:49 -07:00
parent 08f1c86041
commit 13a37f74a1
5 changed files with 30 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ def check_full_name(full_name_raw):
full_name = full_name_raw.strip()
if len(full_name) > UserProfile.MAX_NAME_LENGTH:
raise JsonableError(_("Name too long!"))
if len(full_name) < UserProfile.MIN_NAME_LENGTH:
raise JsonableError(_("Name too short!"))
if list(set(full_name).intersection(UserProfile.NAME_INVALID_CHARS)):
raise JsonableError(_("Invalid characters in name!"))
return full_name