From b39464399146c9234b25863f8fae32c050db10a4 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 28 Nov 2017 18:10:17 +0630 Subject: [PATCH] license --- app/controllers/application_controller.rb | 5 +++-- app/controllers/install_controller.rb | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 91103651..e7cdf4bf 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -55,10 +55,11 @@ class ApplicationController < ActionController::Base def cache_license(url, lookup) flag = ENV["AES_IV"] - @license = License.new(url, lookup) - # Export for Key + @license = License.new(url, lookup) + # Check Exists IV if flag == "<%= ENV['AES_IV'] %>" + # Export for Key aes = MyAesCrypt.new aes_key, aes_iv = aes.export_key(lookup) else diff --git a/app/controllers/install_controller.rb b/app/controllers/install_controller.rb index 52ecc296..faa789d9 100755 --- a/app/controllers/install_controller.rb +++ b/app/controllers/install_controller.rb @@ -13,10 +13,16 @@ class InstallController < BaseController db_schema = params[:db_schema] db_user = params[:db_user] db_password = params[:db_password] - - # Export for Key - aes = MyAesCrypt.new - aes_key, aes_iv = aes.export_key(license_key) + + # Check Exists IV + if flag == "<%= ENV['AES_IV'] %>" + # Export for Key + aes = MyAesCrypt.new + aes_key, aes_iv = aes.export_key(lookup) + else + aes_key = ENV["AES_KEY"] + aes_iv = ENV["AES_IV"] + end @license = License.new(ENV["SX_PROVISION_URL"]) response = @license.license_activate(aes_key, aes_iv, license_key, db_host, db_schema, db_user, db_password)