Ability to block user
This commit is contained in:
parent
fb6d4511a0
commit
497ee5fbbc
9 changed files with 60 additions and 25 deletions
|
@ -16,6 +16,16 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
protected
|
||||
|
||||
def after_sign_in_path_for resource
|
||||
if resource.is_a?(User) && resource.respond_to?(:blocked) && resource.blocked
|
||||
sign_out resource
|
||||
flash[:alert] = "Your account was blocked"
|
||||
new_user_session_path
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def layout_by_resource
|
||||
if devise_controller?
|
||||
"devise"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue