From e7d1428b749024096b9a22b331d110bcf04f87d1 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 12 Feb 2013 17:02:21 +0100 Subject: filter non-ascii characters --- app/models/intruder.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/intruder.rb b/app/models/intruder.rb index db14bf8..8877c4c 100644 --- a/app/models/intruder.rb +++ b/app/models/intruder.rb @@ -18,10 +18,10 @@ class Intruder < ActiveRecord::Base before_validation :set_key_if_empty - def whois - if ! self.contact_ip.blank? + def whois(ip_address = self.contact_ip) + if ! ip_address.blank? begin - return Whois.whois(self.contact_ip) + return Whois.whois(ip_address).to_s.gsub(/[^A-Za-z0-9\:\_\-\ \+\.\,\n]/, '') rescue return nil end -- cgit v1.2.3