summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/intruder.rb4
-rw-r--r--app/views/intruders/_index_core.html.haml2
-rw-r--r--app/views/intruders/show.html.haml3
3 files changed, 9 insertions, 0 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index 9c01634..c305bd3 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -25,6 +25,10 @@ class Intruder < ActiveRecord::Base
key
end
+ def country
+ GeoIpCountry.find_by_ip(self.contact_ip)
+ end
+
def whois(ip_address = self.contact_ip)
if ! ip_address.blank?
begin
diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml
index 1fca601..fa1cf8f 100644
--- a/app/views/intruders/_index_core.html.haml
+++ b/app/views/intruders/_index_core.html.haml
@@ -2,6 +2,7 @@
%tr
%th
%th= t('intruders.index.contact_ip')
+ %th= t('intruders.index.country')
%th= t('intruders.index.points')
%th= t('intruders.index.ban_last')
%th= t('intruders.index.contact_count')
@@ -31,6 +32,7 @@
%i.icon-warning-sign
%td= intruder.contact_ip
+ %td= intruder.country
%td= intruder.points
%td
- if intruder.ban_last
diff --git a/app/views/intruders/show.html.haml b/app/views/intruders/show.html.haml
index df50872..5096941 100644
--- a/app/views/intruders/show.html.haml
+++ b/app/views/intruders/show.html.haml
@@ -22,6 +22,9 @@
%strong= t('intruders.show.contact_ip') + ":"
= @intruder.contact_ip
%p
+ %strong= t('intruders.show.country') + ":"
+ = @intruder.country
+%p
%strong= t('intruders.show.contact_port') + ":"
= @intruder.contact_port
%p