checking for banned user, better banned msg style
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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?)
|
||||
|
||||
Reference in New Issue
Block a user