diff --git a/app/assets/stylesheets/screen.css.scss b/app/assets/stylesheets/screen.css.scss index 25f93d2..992c22d 100644 --- a/app/assets/stylesheets/screen.css.scss +++ b/app/assets/stylesheets/screen.css.scss @@ -438,16 +438,7 @@ and (min-width: 0px) //TODO float: right; } - .user-banned { - background: #AB0000; - color: white; - font-weight: bold; - padding: 4px; - display: block; - border-radius: 3px; - } - - .user-unconfirmed { + .user-unconfirmed, .user-banned { background: #AB0000; color: white; font-weight: bold; @@ -455,7 +446,6 @@ and (min-width: 0px) //TODO display: inline-block; border-radius: 3px; margin: 10px 0; - box-shadow: 0 0 10px #000; } .btn { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5e7c617..cd18e4c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,6 @@ class ApplicationController < ActionController::Base protect_from_forgery - before_filter :update_ip, :update_seen + before_filter :update_ip, :update_seen, :check_banned # force_ssl http_basic_authenticate_with name: "redstone", password: "sheep_" @@ -18,6 +18,8 @@ class ApplicationController < ActionController::Base helper_method :superadmin? helper_method :donor? helper_method :confirmed? + + private def update_ip @@ -32,6 +34,15 @@ class ApplicationController < ActionController::Base @current_user ||= User.find_by_id(session[:user_id]) end + def check_banned + if current_user && current_user.banned? + session.delete(:user_id) + flash[:alert] = "You are banned!" + redirect_to login_path + end + end + + #roles def disabled? !!(current_user && current_user.disabled?)