From: John Dong Date: Wed, 15 Aug 2007 21:03:41 +0000 (-0400) Subject: Record "XMLRPC Request" in ipadress field of XML RPC created votes. X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/597c27db39d8b36e623a9d6573e75edf657142c0 Record "XMLRPC Request" in ipadress field of XML RPC created votes. Added IPAddr verification of IP Addresses --- 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 %>