From 1187ddba373343a7f785227338c3c3665530302d Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 19 Apr 2018 16:40:59 +0630 Subject: [PATCH] move check license to action controler --- .../concerns/login_verification.rb | 12 ----------- config/initializers/action_controller.rb | 20 ++++++++++++++----- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index 14b1e2e1..590fdcbc 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -53,16 +53,4 @@ module LoginVerification def render_unauthorized redirect_to root_path end - - private - def check_license - License.check_license_file - end - - def check_installation - if current_company.nil? - redirect_to install_path - end - end - end diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 802324cf..9284042f 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,11 @@ class ActionController::Base end else #check for license file - # if check_license - # current_license(ENV["SX_PROVISION_URL"]) - # else - # redirect_to activate_path - # end + if check_license + current_license(ENV["SX_PROVISION_URL"]) + else + redirect_to activate_path + end end end @@ -50,6 +50,16 @@ class ActionController::Base end end + def check_license + License.check_license_file + end + + def check_installation + if current_company.nil? + redirect_to install_path + end + end + def website_connection(license) default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase, :username => license.dbusername, :password => license.dbpassword)