mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Added support for Email and Auth blacklists
This commit is contained in:
@@ -51,6 +51,7 @@ BLACKLIST_TYPE_CHARACTER = 1
|
|||||||
BLACKLIST_TYPE_CORPORATION = 2
|
BLACKLIST_TYPE_CORPORATION = 2
|
||||||
BLACKLIST_TYPE_ALLIANCE = 3
|
BLACKLIST_TYPE_ALLIANCE = 3
|
||||||
BLACKLIST_TYPE_EMAIL = 4
|
BLACKLIST_TYPE_EMAIL = 4
|
||||||
|
BLACKLIST_TYPE_AUTH = 5
|
||||||
|
|
||||||
BLACKLIST_TYPE_CHOICES = (
|
BLACKLIST_TYPE_CHOICES = (
|
||||||
(BLACKLIST_TYPE_REDDIT, 'Reddit Account'),
|
(BLACKLIST_TYPE_REDDIT, 'Reddit Account'),
|
||||||
@@ -58,4 +59,5 @@ BLACKLIST_TYPE_CHOICES = (
|
|||||||
(BLACKLIST_TYPE_CORPORATION, 'Corporation'),
|
(BLACKLIST_TYPE_CORPORATION, 'Corporation'),
|
||||||
(BLACKLIST_TYPE_ALLIANCE, 'Alliance'),
|
(BLACKLIST_TYPE_ALLIANCE, 'Alliance'),
|
||||||
(BLACKLIST_TYPE_EMAIL, 'Email Address'),
|
(BLACKLIST_TYPE_EMAIL, 'Email Address'),
|
||||||
|
(BLACKLIST_TYPE_AUTH, 'Auth Account'),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -35,10 +35,15 @@ class Application(models.Model):
|
|||||||
# Check Reddit blacklists
|
# Check Reddit blacklists
|
||||||
reddit_uids = self.user.redditaccount_set.all().values_list('username')
|
reddit_uids = self.user.redditaccount_set.all().values_list('username')
|
||||||
reddit = [a[0].lower() for a in reddit_uids if a and a[0]]
|
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)
|
objs = bl_items.filter(type=BLACKLIST_TYPE_REDDIT, value__in=reddit)
|
||||||
blacklist.extend(objs)
|
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
|
# Check EVE Related blacklists
|
||||||
evechars = EVEPlayerCharacter.objects.filter(eveaccount__user=self.user).select_related('corporation__alliance')
|
evechars = EVEPlayerCharacter.objects.filter(eveaccount__user=self.user).select_related('corporation__alliance')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user