Class: ClientManager::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/client_manager/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_superadminObject



21
22
23
24
25
26
27
# File 'app/controllers/client_manager/application_controller.rb', line 21

def authenticate_superadmin
  authenticate_user
  if !client_manager_current_user.superadmin
    flash[:error] = "Unauthorized"
    redirect_to 
  end
end

#authenticate_userObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/client_manager/application_controller.rb', line 11

def authenticate_user
  if !client_manager_current_user
    flash[:error] = "Unauthorized"
    redirect_to 
  elsif !client_manager_current_user.password_changed
    flash[:error] = "You must change your password before proceeding"
    redirect_to change_password_path
  end
end

#client_manager_current_userObject



6
7
8
# File 'app/controllers/client_manager/application_controller.rb', line 6

def client_manager_current_user
  @client_manager_current_user ||= session[:client_manager_current_user_id] && ClientManager::User.find_by_id(session[:client_manager_current_user_id])
end