commit
f22488f726
15 changed files with 68 additions and 33 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue