config: Add user websites as choices for homepage config.

Closes: #1981
Closes also most of threads in !1952.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Fioddor Superconcentrado authored and James Valleroy committed 2020-12-13 08:20:26 -05:00
1 parent f527d9af83
commit 337e8c28dd
8 files changed
+323 -32

No files matched your search

+18
View File
@@ -58,6 +58,24 @@ def user_group_view(func, group_name):
return func
def is_valid_user_name(user_name):
"""Check if the given username is valid.
Note: Debian is VERY flexible with user names.
"""
if 32 < len(user_name):
return False
if user_name.startswith('-'):
return False
for forbidden in (' \n\t/\\:'):
if forbidden in user_name:
return False
return True
def is_user_admin(request, cached=False):
"""Return whether user is an administrator."""
if not request.user.is_authenticated: