adding license
This commit is contained in:
@@ -23,8 +23,8 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
# if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = current_license(ENV["SX_PROVISION_URL"], "chromisreal-16") # request.subdomain.downcase
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
@@ -35,16 +35,17 @@ class ApplicationController < ActionController::Base
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, key)
|
||||
@license = License.new(url, key)
|
||||
|
||||
##creating md5 hash
|
||||
md5_hostname = Digest::MD5.new
|
||||
md5key = md5_hostname.update(request.host)
|
||||
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||
# Export for Key
|
||||
passphrase = key + ENV["secret_key_base"]
|
||||
key, iv = AESEncDec.export_key(passphrase)
|
||||
|
||||
if (@license.detail_with_local_file(key, key, iv) == true)
|
||||
#if (@license.detail == true)
|
||||
|
||||
return @license
|
||||
|
||||
Reference in New Issue
Block a user