diff options
author | Andrew8xx8 <avk@8xx8.ru> | 2013-03-04 18:52:30 +0400 |
---|---|---|
committer | Andrew8xx8 <avk@8xx8.ru> | 2013-03-04 18:52:30 +0400 |
commit | 0d9a6fe7b16e52cc4d5595d6b26552c39911cf07 (patch) | |
tree | 96e0725dfb072df84198f1c2e2407ceda41caa3b /app/controllers | |
parent | 9a06dd4aa1ab008b6e12205ec3f8d00a50f79aa1 (diff) | |
download | gitlab-ce-0d9a6fe7b16e52cc4d5595d6b26552c39911cf07.tar.gz |
User's blocked field refactored to use state machine
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/users_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 2e7114e10a9..43e6f09904f 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -45,7 +45,7 @@ class Admin::UsersController < Admin::ApplicationController end def unblock - if admin_user.update_attribute(:blocked, false) + if admin_user.activate redirect_to :back, alert: "Successfully unblocked" else redirect_to :back, alert: "Error occured. User was not unblocked" diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5b886227bc9..6b72f325204 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base end def reject_blocked! - if current_user && current_user.blocked + if current_user && current_user.blocked? sign_out current_user flash[:alert] = "Your account is blocked. Retry when an admin unblock it." redirect_to new_user_session_path @@ -38,7 +38,7 @@ class ApplicationController < ActionController::Base end def after_sign_in_path_for resource - if resource.is_a?(User) && resource.respond_to?(:blocked) && resource.blocked + if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked? sign_out resource flash[:alert] = "Your account is blocked. Retry when an admin unblock it." new_user_session_path |