get the right redirected ip
This commit is contained in:
@@ -267,11 +267,19 @@ class FakeAdminLoginView(View):
|
||||
return context
|
||||
|
||||
def get(self, request):
|
||||
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
|
||||
if x_forwarded_for:
|
||||
ip = x_forwarded_for.split(',')[0]
|
||||
else:
|
||||
ip = request.META.get("REMOTE_ADDR")
|
||||
hacker, created = SecurityBreachAttemptModel.objects.get_or_create(ip=ip)
|
||||
return render(request, 'admin/fake_login.html', self.get_context(request))
|
||||
|
||||
def post(self, request):
|
||||
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
|
||||
if x_forwarded_for:
|
||||
ip = x_forwarded_for.split(',')[0]
|
||||
else:
|
||||
ip = request.META.get("REMOTE_ADDR")
|
||||
hacker, created = SecurityBreachAttemptModel.objects.get_or_create(ip=ip)
|
||||
hacker.trys += 1
|
||||
|
||||
Reference in New Issue
Block a user