Added ban reason and expiration date to user pages

This commit is contained in:
MrYummy
2017-06-20 16:22:56 +02:00
parent 992406a20b
commit 8dc051ea46
2 changed files with 7 additions and 4 deletions

View File

@@ -30,6 +30,8 @@ class UsersController < ApplicationController
end end
def show def show
user = User.find(params[:id])
@ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"] == user.uuid}
end end
# SIGNUP # SIGNUP

View File

@@ -15,11 +15,12 @@
<h1><%= @user.name %></h1> <h1><%= @user.name %></h1>
<div class="clear"></div> <div class="clear"></div>
<% if @ban_json %>
<% if @user.banned? %> <span class="user-banned">This used is banned for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
<span class="user-banned">This user is banned!</span> <% elsif @user.banned? %>
<span class="user-banned">This user is banned!</span>
<% end %> <% end %>
<br>
<% if !@user.confirmed? %> <% if !@user.confirmed? %>
<% if @user.is?(current_user) || mod? %> <% if @user.is?(current_user) || mod? %>
<span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span> <span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span>