update install controller skip set current tenant

This commit is contained in:
Thein Lin Kyaw
2020-01-21 09:56:51 +06:30
parent 0a5aff4c94
commit d054776357
2 changed files with 18 additions and 30 deletions

View File

@@ -1,7 +1,6 @@
class InstallController < BaseController
skip_before_action :lookup_domain
skip_before_action :set_current_tenant_by_subdomain_or_first
skip_before_action :verify_authenticity_token
# before_action :check_license
def index
end
@@ -39,27 +38,16 @@ class InstallController < BaseController
end
end
def check_license
if License.check_license_file
def lookup_domain
if (ENV["SERVER_MODE"] == "application") ||
(request.subdomain.present? && request.subdomain != "www" && ENV["SERVER_MODE"] != "cloud")
if check_license(request.host)
redirect_to root_url
end
else
not_found
end
end
# def lookup_domain
# if request.subdomain.present? && request.subdomain != "www"
# @license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
# if (!@license.nil?)
# # logger.info "Location - " + @license.name
# ActiveRecord::Base.establish_connection(website_connection(@license))
# # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
# else
# # reconnect_default_db
# logger.info 'License is nil'
# # redirect_to root_url(:host => request.domain) + "store_error"
# render :json => [{ status: false, message: 'Invalid Access!'}]
# end
# end
# end
# def current_license(url, key)
# @license = License.new(url, key)

View File

@@ -26,11 +26,11 @@ class ActionController::Base
redirect_to activate_path
end
else
render_not_found
not_found
end
end
def render_not_found
def not_found
respond_to do |format|
format.html { render :file => "#{Rails.root}/public/404", :layout => false, :status => :not_found }
format.json { head :not_found }