From 597c27db39d8b36e623a9d6573e75edf657142c0 Mon Sep 17 00:00:00 2001 From: John Dong Date: Wed, 15 Aug 2007 17:03:41 -0400 Subject: [PATCH] Record "XMLRPC Request" in ipadress field of XML RPC created votes. Added IPAddr verification of IP Addresses --- app/models/selectricity_service.rb | 2 +- app/views/quickvote/results.rhtml | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/selectricity_service.rb b/app/models/selectricity_service.rb index ac2ef20..add5ab9 100644 --- a/app/models/selectricity_service.rb +++ b/app/models/selectricity_service.rb @@ -7,7 +7,7 @@ class SelectricityService < ActionWebService::Base if election voter = QuickVoter.new voter.election = election - voter.ipaddress = "0.0.0.0" + voter.ipaddress = "XMLRPC Request" voter.session_id = "XMLRPC:#{voter_id}" voter.vote=Vote.new voter.vote.votes=vote_list[0] diff --git a/app/views/quickvote/results.rhtml b/app/views/quickvote/results.rhtml index 1fad7ea..98a71e5 100644 --- a/app/views/quickvote/results.rhtml +++ b/app/views/quickvote/results.rhtml @@ -1,4 +1,4 @@ -<% %> +<%require 'IPAddr' %>

Results

<% if @election.shortdesc %> @@ -156,7 +156,13 @@ by several other names.

<% next unless voter.voted? %> <%= voter.ipaddress %> - <%= `host #{voter.ipaddress}`.sub(/^.*pointer (.*)\.$/, '\1') %> + <% begin %> + <%= `host #{IPAddr.new(voter.ipaddress).to_s}`.sub(/^.*pointer (.*)\.$/, '\1') %> + + <% rescue ArgumentError => err %> + <%= " - " %> + <% end %> + <%= voter.vote.votestring %> <% end %> -- 2.30.2