add license and encryption for cloud

This commit is contained in:
Yan
2017-11-10 14:34:46 +06:30
11 changed files with 123 additions and 63 deletions

View File

@@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
# lookup domain for db from provision
before_action :lookup_domain, :set_locale
before_action :check_license, :lookup_domain, :set_locale
helper_method :current_company,:current_login_employee,:current_user
# alias_method :current_user, :current_login_employee,:current_user
@@ -42,11 +42,12 @@ class ApplicationController < ActionController::Base
@license = License.new(url, subdomain)
##creating md5 hash
md5_hostname = Digest::MD5.new
md5key = md5_hostname.update(request.host)
if (@license.detail_with_local_cache(subdomain, md5key.to_s) == true)
#if (@license.detail == true)
# md5_hostname = Digest::MD5.new
# md5key = md5_hostname.update(request.host)
# if (@license.detail_with_local_cache(subdomain, md5key.to_s) == true)
#if (@license.detail == true)
if (@license.detail_with_local_cache(subdomain) == true)
return @license
else
return nil
@@ -94,7 +95,11 @@ class ApplicationController < ActionController::Base
private
def check_license
if current_company.nil?
if License.check_license_file
# if !License.check_license_valid
# redirect_to install_path
# end
else
redirect_to install_path
end
end