summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-03-27 09:49:23 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2019-02-24 12:58:40 -0500
commiteef9e9f5b036cbd856a30ae74632c321238470e1 (patch)
tree0566e11a3af07decd7974890d5375beaa02782a2
parentc83f009ce27bf04cf130347a3e00559c76d62138 (diff)
branding: make the domain name regex configurable
This implements Dan's 2012 TODO: configurable domain/regex somewhere?
-rw-r--r--devel/utils.py4
-rw-r--r--settings.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/devel/utils.py b/devel/utils.py
index bd57def9..3326987a 100644
--- a/devel/utils.py
+++ b/devel/utils.py
@@ -1,5 +1,6 @@
import re
+from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db import connection
@@ -78,9 +79,8 @@ class UserFinder(object):
if email and '@' in email:
# split email addr at '@' symbol, ensure domain matches
# or is a subdomain of archlinux.org
- # TODO: configurable domain/regex somewhere?
username, domain = email.split('@', 1)
- if re.match(r'^(.+\.)?archlinux.org$', domain):
+ if re.match(settings.DOMAIN_RE, domain):
return User.objects.get(username=username)
return None
diff --git a/settings.py b/settings.py
index 4393e693..31070d02 100644
--- a/settings.py
+++ b/settings.py
@@ -172,6 +172,8 @@ TORRENT_TRACKERS = (
'http://tracker.archlinux.org:6969/announce',
)
+DOMAIN_RE = r'^(.+\.)?archlinux.org$'
+
# Shorten some names just a bit
COUNTRIES_OVERRIDE = {
'GB': 'United Kingdom',