check subdomain for license
This commit is contained in:
@@ -43,6 +43,8 @@ class InstallController < BaseController
|
||||
(request.subdomain.present? && request.subdomain != "www" && ENV["SERVER_MODE"] != "cloud")
|
||||
if check_license(request.host)
|
||||
redirect_to root_url
|
||||
else
|
||||
not_found unless check_subdomain(request.host)
|
||||
end
|
||||
else
|
||||
not_found
|
||||
|
||||
@@ -195,6 +195,20 @@ class License
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_license_subdomain(lookup)
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_key(license_key)
|
||||
|
||||
server_mode = ENV["SERVER_MODE"]
|
||||
unless ENV["SERVER_MODE"] == "cloud"
|
||||
server_mode = "application"
|
||||
end
|
||||
|
||||
params = { query: { lookup_type: server_mode, lookup: lookup, iv_key: aes_iv} }
|
||||
response = self.class.get("/subdomain", params)
|
||||
response.parsed_response["status"]
|
||||
end
|
||||
|
||||
# Check License File exists
|
||||
def self.check_license_file(lookup)
|
||||
return unless File.exist?("config/license.yml")
|
||||
|
||||
Reference in New Issue
Block a user