Skip to content

Commit

Permalink
locked down the defender views
Browse files Browse the repository at this point in the history
  • Loading branch information
kencochrane committed Jan 29, 2015
1 parent d0a23a7 commit 389ae2d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions defender/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.admin.views.decorators import staff_member_required

from .utils import (
get_blocked_ips, get_blocked_usernames, unblock_ip, unblock_username)


@staff_member_required
def block_view(request):
""" List the blocked IP and Usernames """
blocked_ip_list = get_blocked_ips()
Expand All @@ -19,13 +21,15 @@ def block_view(request):
context, context_instance=RequestContext(request))


@staff_member_required
def unblock_ip_view(request, ip):
""" upblock the given ip """
if request.method == 'POST':
unblock_ip(ip)
return HttpResponseRedirect(reverse("defender_blocks_view"))


@staff_member_required
def unblock_username_view(request, username):
""" unblockt he given username """
if request.method == 'POST':
Expand Down

0 comments on commit 389ae2d

Please sign in to comment.