need to fix license
This commit is contained in:
@@ -46,7 +46,6 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def current_license(url)
|
def current_license(url)
|
||||||
@license = License.new(url)
|
@license = License.new(url)
|
||||||
|
|
||||||
if (@license.detail_with_local_file() == true)
|
if (@license.detail_with_local_file() == true)
|
||||||
puts "RUN SAY BYAR"
|
puts "RUN SAY BYAR"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class BaseController < ActionController::Base
|
class BaseController < ActionController::Base
|
||||||
layout "installation"
|
layout "installation"
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -69,11 +69,32 @@ class License
|
|||||||
|
|
||||||
# For Local System
|
# For Local System
|
||||||
def detail_with_local_file()
|
def detail_with_local_file()
|
||||||
has_license = true # verify_license()
|
aes = MyAesCrypt.new
|
||||||
|
aes_key, aes_iv = aes.export_key(lookup)
|
||||||
|
renewal_date_str = read_license("renewable_date")
|
||||||
|
|
||||||
if has_license
|
# ##Check from local redis - if available load local otherwise get from remote
|
||||||
puts "VERIFIED"
|
# renewable_date = "renewable_date:#{renewal_date_str}"
|
||||||
|
|
||||||
|
# ##Get redis connection from connection pool
|
||||||
|
# redis = Redis.new
|
||||||
|
# cache_renewable_date = redis.get(renewable_date)
|
||||||
|
# if cache_renewable_date.nil?
|
||||||
|
# redis = Redis.new
|
||||||
|
# redis.set(renewable_date, Marshal.dump(@license))
|
||||||
|
# else
|
||||||
|
# get_renewable_date = Marshal.load(cache_renewable_date)
|
||||||
|
if check_expiring(renewal_date_str)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
has_license = verify_license()
|
||||||
|
|
||||||
|
if has_license
|
||||||
|
puts "VERIFIED"
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# License Activation
|
# License Activation
|
||||||
@@ -115,6 +136,12 @@ class License
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check Expired before 30 days
|
||||||
|
def check_expiring(renewal_date_str)
|
||||||
|
renewal_date = DateTime.parse(renewal_date_str)
|
||||||
|
renewal_date > Date.today.advance(:days => 30)
|
||||||
|
end
|
||||||
|
|
||||||
# Check License expired date from PROVISION SERVER
|
# Check License expired date from PROVISION SERVER
|
||||||
def check_expired(renewal_date_str)
|
def check_expired(renewal_date_str)
|
||||||
renewal_date = DateTime.parse(renewal_date_str)
|
renewal_date = DateTime.parse(renewal_date_str)
|
||||||
@@ -185,6 +212,9 @@ class License
|
|||||||
f.puts("dbpassword: #{response_data['dbpassword']}")
|
f.puts("dbpassword: #{response_data['dbpassword']}")
|
||||||
f.puts("api_token: #{response_data['api_token']}")
|
f.puts("api_token: #{response_data['api_token']}")
|
||||||
f.puts("app_token: #{response_data['app_token']}")
|
f.puts("app_token: #{response_data['app_token']}")
|
||||||
|
f.puts("plan_sku: #{response_data['plan_sku']}")
|
||||||
|
f.puts("renewable_date: #{response_data['renewable_date']}")
|
||||||
|
f.puts("plan_name: #{response_data['plan_name']}")
|
||||||
end
|
end
|
||||||
rescue IOError
|
rescue IOError
|
||||||
response = { "status": false, "message": "Activation is success but something is wrong. \n Please contact code2lab call center!"}
|
response = { "status": false, "message": "Activation is success but something is wrong. \n Please contact code2lab call center!"}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ dbusername: LapN+Geriht8yk866FxNiQ==
|
|||||||
dbpassword: QtboWZ4ATE05vvYw6J+Uqw==
|
dbpassword: QtboWZ4ATE05vvYw6J+Uqw==
|
||||||
api_token: nGyMizHtoVEFYCjSVEFJuzkxuBJwSsH
|
api_token: nGyMizHtoVEFYCjSVEFJuzkxuBJwSsH
|
||||||
app_token: QUdPwSakcsnuVLdfkXgGHhPMiIOcSSfaVwQyA
|
app_token: QUdPwSakcsnuVLdfkXgGHhPMiIOcSSfaVwQyA
|
||||||
|
plan_sku: 9+83FZetcbLZi6COG5PbSw==
|
||||||
plan_sku: 001
|
renewable_date: shztSYIsNmM9nlHkR/4exQ==
|
||||||
renewable_date: 2018-12-14
|
plan_name: LapN+Geriht8yk866FxNiQ==
|
||||||
plan_name: Community
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: 192.168.1.147:3002/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
sx_provision_url: 192.168.1.147:3002/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||||
server_mode: cloud
|
server_mode: application
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
aes_key: <%= ENV['AES_KEY'] %>
|
aes_key: <%= ENV['AES_KEY'] %>
|
||||||
|
|||||||
Reference in New Issue
Block a user