FIX: ip lookup not working

Also add a powered by line so it is clear this makes an external service call
This commit is contained in:
Sam 2017-08-21 14:18:40 -04:00
parent c264348fcb
commit 2f0c6c99e0
4 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<div class="location-box">
<a class="close pull-right" {{action "hide"}}>{{d-icon "times"}}</a>
<h4>{{i18n 'ip_lookup.title'}}</h4>
<p class='powered-by'>{{{i18n 'ip_lookup.powered_by'}}}</p>
<dl>
{{#if location}}
{{#if location.hostname}}

View File

@ -193,6 +193,13 @@ td.flaggers td {
background-color: $secondary;
padding: 12px 12px 5px;
.powered-by {
font-size: 0.80em;
position: absolute;
bottom: -10px;
left: 10px;
}
.other-accounts {
margin: 5px 0 0;
max-height: 200px;

View File

@ -292,7 +292,7 @@ class Admin::UsersController < Admin::AdminController
ip = params[:ip]
# should we cache results in redis?
location = Excon.get("http://ipinfo.io/#{ip}/json", read_timeout: 30, connect_timeout: 30).body rescue nil
location = Excon.get("https://ipinfo.io/#{ip}/json", read_timeout: 10, connect_timeout: 10).body rescue nil
render json: location
end

View File

@ -550,6 +550,7 @@ en:
topics_entered: "topics entered"
post_count: "# posts"
confirm_delete_other_accounts: "Are you sure you want to delete these accounts?"
powered_by: "powered by <a href='https://ipinfo.io'>ipinfo.io</a>"
user_fields:
none: "(select an option)"