diff options
author | Logan Fick <logaldeveloper@protonmail.com> | 2017-11-24 22:01:37 -0500 |
---|---|---|
committer | Logan Fick <logaldeveloper@protonmail.com> | 2017-11-24 22:01:37 -0500 |
commit | 8796b3a415ff53e0bf79a5c030328365aa8156d5 (patch) | |
tree | e037f09bb61e479565325d61a3a41c4973a853d1 /app | |
parent | 12baf8d5d7ffed8fd66b1fe5e48bbbc39324d04b (diff) |
Made user profile page show hostname of user's IP address.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/users_controller.rb | 6 | ||||
-rw-r--r-- | app/views/users/show.html.erb | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 66b07fd..e86db8b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -22,6 +22,12 @@ class UsersController < ApplicationController flash.now[:alert] = "An error occured while checking if this user is banned from the server!" @ban_json = nil end + + begin + @hostname = Resolv.new.getname(@user.last_ip) + rescue + @hostname = "No hostname found." + end end # SIGNUP diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index cafe726..8726f8e 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -85,7 +85,7 @@ <% if mod? || @user.is?(current_user) %> <tr> <td><b>Last IP</b></td> - <td><%= @user.last_ip %></td> + <td><%= @user.last_ip %> (<%= @hostname %>)</td> </tr> <tr> <td><b>Email</b></td> |