diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-03-27 09:49:23 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-01-15 14:03:20 -0500 |
commit | db7e08307134ad42c756234ae900b9cdc849badc (patch) | |
tree | f597672d1fa486c94ed177394ef040e1f41f00b7 | |
parent | e6c0f94cb5e5ffaba13d7927afb08c523d598f12 (diff) |
branding: make the domain name regex configurable
This implements Dan's 2012 TODO: configurable domain/regex somewhere?
-rw-r--r-- | devel/utils.py | 4 | ||||
-rw-r--r-- | settings.py | 2 |
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', |