diff --git a/app/controllers/base_crm_controller.rb b/app/controllers/base_crm_controller.rb index 970ffe17..5c412fcf 100755 --- a/app/controllers/base_crm_controller.rb +++ b/app/controllers/base_crm_controller.rb @@ -1,5 +1,4 @@ class BaseCrmController < ApplicationController - include LoginVerification layout "CRM" #before_action :check_installation diff --git a/app/controllers/base_inventory_controller.rb b/app/controllers/base_inventory_controller.rb index 1d99c766..f44747d3 100755 --- a/app/controllers/base_inventory_controller.rb +++ b/app/controllers/base_inventory_controller.rb @@ -1,5 +1,4 @@ class BaseInventoryController < ApplicationController - include LoginVerification layout "inventory" #before_action :check_installation diff --git a/app/controllers/base_oqs_controller.rb b/app/controllers/base_oqs_controller.rb index b50684de..f1f2831a 100755 --- a/app/controllers/base_oqs_controller.rb +++ b/app/controllers/base_oqs_controller.rb @@ -1,5 +1,4 @@ class BaseOqsController < ApplicationController - include LoginVerification layout "OQS" #before_action :check_installation diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 8a79c009..58d9b801 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -1,5 +1,4 @@ class BaseOrigamiController < ApplicationController - include LoginVerification layout "origami" # before_action :checkin_process diff --git a/app/controllers/base_report_controller.rb b/app/controllers/base_report_controller.rb index a9fe207b..f7551f22 100755 --- a/app/controllers/base_report_controller.rb +++ b/app/controllers/base_report_controller.rb @@ -1,5 +1,4 @@ class BaseReportController < ApplicationController - include LoginVerification layout "application" #before_action :check_installation diff --git a/app/controllers/base_waiter_controller.rb b/app/controllers/base_waiter_controller.rb index ca793e17..248e32a6 100755 --- a/app/controllers/base_waiter_controller.rb +++ b/app/controllers/base_waiter_controller.rb @@ -1,5 +1,4 @@ class BaseWaiterController < ApplicationController - include LoginVerification layout "waiter" #before_action :check_installation diff --git a/app/controllers/concerns/license_verification.rb b/app/controllers/concerns/license_verification.rb index b838a48f..94e9ad91 100644 --- a/app/controllers/concerns/license_verification.rb +++ b/app/controllers/concerns/license_verification.rb @@ -29,6 +29,7 @@ module LicenseVerification # redirect_to activate_path # end end + authenticate_session_token end def authenticate_session_token @@ -38,9 +39,12 @@ module LicenseVerification #Rails.logger.debug "token - " + token.to_s @user = Employee.authenticate_by_token(token) - if !@user + if @user + return true + #Maybe log - login? + else flash[:notice] = 'Invalid Access!' - redirect_to root_path + # return false end end end diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index bb98cf2e..aa9d8319 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -6,6 +6,21 @@ module LoginVerification helper_method :current_company,:current_login_employee end + #this is base api base controller to need to inherit. + #all token authentication must be done here + #response format must be set to JSON + def current_company + begin + return Company.first + rescue + return nil + end + + end + + def current_login_employee + @employee = Employee.find_by_token_session(session[:session_token]) + end protected # Authenticate the user with token based authentication @@ -34,23 +49,6 @@ module LoginVerification redirect_to root_path end - - #this is base api base controller to need to inherit. - #all token authentication must be done here - #response format must be set to JSON - def current_company - begin - return Company.first - rescue - return nil - end - - end - - def current_login_employee - @employee = Employee.find_by_token_session(session[:session_token]) - end - private def check_license License.check_license_file diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 5c0d4117..e1b51e86 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,4 @@ class HomeController < ApplicationController - include LoginVerification # layout "application", except: [:index, :show] # skip_before_action only: [:index, :show, :create, :update, :destroy] diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index 329b0fa2..a72319b3 100755 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -1,5 +1,4 @@ class PrintSettingsController < ApplicationController - include LoginVerification load_and_authorize_resource except: [:create] before_action :set_print_setting, only: [:show, :edit, :update, :destroy]