Added support for Email and Auth blacklists

This commit is contained in:
2010-07-07 11:05:34 +01:00
parent 07407cc1e0
commit 9d009a0cf7
2 changed files with 8 additions and 1 deletions

View File

@@ -51,6 +51,7 @@ BLACKLIST_TYPE_CHARACTER = 1
BLACKLIST_TYPE_CORPORATION = 2
BLACKLIST_TYPE_ALLIANCE = 3
BLACKLIST_TYPE_EMAIL = 4
BLACKLIST_TYPE_AUTH = 5
BLACKLIST_TYPE_CHOICES = (
(BLACKLIST_TYPE_REDDIT, 'Reddit Account'),
@@ -58,4 +59,5 @@ BLACKLIST_TYPE_CHOICES = (
(BLACKLIST_TYPE_CORPORATION, 'Corporation'),
(BLACKLIST_TYPE_ALLIANCE, 'Alliance'),
(BLACKLIST_TYPE_EMAIL, 'Email Address'),
(BLACKLIST_TYPE_AUTH, 'Auth Account'),
)

View File

@@ -35,10 +35,15 @@ class Application(models.Model):
# Check Reddit blacklists
reddit_uids = self.user.redditaccount_set.all().values_list('username')
reddit = [a[0].lower() for a in reddit_uids if a and a[0]]
objs = bl_items.filter(type=BLACKLIST_TYPE_REDDIT, value__in=reddit)
blacklist.extend(objs)
# Check email blacklists
blacklist.extend(bl_items.filter(type=BLACKLIST_TYPE_EMAIL, value=self.user.email.lower()))
# Check Auth blacklists
blacklist.extend(bl_items.filter(type=BLACKLIST_TYPE_AUTH, value=self.user.username.lower()))
# Check EVE Related blacklists
evechars = EVEPlayerCharacter.objects.filter(eveaccount__user=self.user).select_related('corporation__alliance')