update license

This commit is contained in:
Thein Lin Kyaw
2020-06-19 10:46:52 +06:30
parent 02ba0f21e6
commit 7e9b4f7120
32 changed files with 387 additions and 393 deletions

View File

@@ -1,5 +1,5 @@
class ActionController::Base
before_action :lookup_domain if Rails.env.production?
before_action :lookup_domain
before_action :set_locale
helper_method :current_license,
@@ -25,12 +25,10 @@ class ActionController::Base
end
elsif ENV["SERVER_MODE"] == "application" || request.subdomains.last && request.subdomains.last != "www"
# check for license file
if !check_license
if ENV["SERVER_MODE"] == "application" || check_subdomain
redirect_to activate_path
else
not_found
end
if !current_license.exists?
redirect_to activate_path
elsif current_license.expired?
redirect_to review_license_path
end
else
not_found
@@ -53,15 +51,6 @@ class ActionController::Base
current_license.check_license_subdomain
end
def check_license
if License.check_license_file(request.host)
if current_license.expired?
return false
end
return true
end
end
def check_installation
if current_company.nil?
redirect_to install_path
@@ -117,7 +106,7 @@ class ActionController::API
not_found
end
elsif ENV["SERVER_MODE"] == "application" || (request.subdomains.last && request.subdomains.last != "www")
not_found unless check_license
not_found unless current_license.exists? && !current_license.expired?
else
not_found
end
@@ -135,15 +124,6 @@ class ActionController::API
end
end
def check_license
if License.check_license_file(request.host)
if current_license.expired?
return false
end
return true
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)