mirror of
https://github.com/Mistake35/Cedar-Django.git
synced 2026-07-18 00:21:14 +10:00
pain
- Added list_filter in admin.py for more models. - IP bans now work when not signed in - Invites are void if you are banned or disabled. - Removed Discord video support (it was a pointless feature) - Various HTML changes - Made the theme much darker. - Changed the color of the logo and favicon. Too lazy to change the rest of the assets for now.
This commit is contained in:
@@ -46,6 +46,15 @@ class CheckForBanMiddleware:
|
||||
return response
|
||||
|
||||
def process_view(self, request, view_func, view_args, view_kwargs):
|
||||
# Get one active ban that is not expired for the IP address
|
||||
ip_address = request.META.get('REMOTE_ADDR')
|
||||
active_ip_ban = Ban.objects.filter(
|
||||
ip_address=ip_address,
|
||||
active=True,
|
||||
expiry_date__gte=timezone.now(),).first()
|
||||
if active_ip_ban:
|
||||
context = {'ban': active_ip_ban}
|
||||
return render(request, 'ban.html', context)
|
||||
if not request.user.is_authenticated:
|
||||
return None
|
||||
# Get one active ban that is not expired for the user
|
||||
@@ -56,15 +65,6 @@ class CheckForBanMiddleware:
|
||||
if active_user_ban:
|
||||
context = {'ban': active_user_ban}
|
||||
return render(request, 'ban.html', context)
|
||||
# Get one active ban that is not expired for the IP address
|
||||
ip_address = request.META.get('REMOTE_ADDR')
|
||||
active_ip_ban = Ban.objects.filter(
|
||||
ip_address=ip_address,
|
||||
active=True,
|
||||
expiry_date__gte=timezone.now(),).first()
|
||||
if active_ip_ban:
|
||||
context = {'ban': active_ip_ban}
|
||||
return render(request, 'ban.html', context)
|
||||
return None
|
||||
|
||||
class ClosedMiddleware(object):
|
||||
|
||||
Reference in New Issue
Block a user