about summary refs log tree commit diff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-06 18:03:30 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-06 18:03:30 +0100
commitf406e01fcf7d69045cf3ad8ea8dea51acd85535b (patch)
treeb1b2c5ac8c44d3b3f4a69e05a707ce641fc4a48a /app/controllers/application_controller.rb
parent2488162733df7d940e1cb26e5ece534c1078f4c8 (diff)
Add filters for suspended accounts
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 7270686de..e2d879d58 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -15,6 +15,7 @@ class ApplicationController < ActionController::Base
   before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
   before_action :set_locale
   before_action :set_user_activity
+  before_action :check_suspension, if: :user_signed_in?
 
   def raise_not_found
     raise ActionController::RoutingError, "No route matches #{params[:unmatched_route]}"
@@ -40,6 +41,10 @@ class ApplicationController < ActionController::Base
     current_user.touch(:current_sign_in_at) if !current_user.nil? && (current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < 24.hours.ago)
   end
 
+  def check_suspension
+    head 403 if current_user.account.suspended?
+  end
+
   protected
 
   def not_found