license verify
This commit is contained in:
@@ -58,7 +58,7 @@ class ApplicationController < ActionController::Base
|
||||
def cache_license(url, lookup)
|
||||
flag = ENV["AES_IV"]
|
||||
@license = License.new(url, lookup)
|
||||
puts flag
|
||||
|
||||
# Check Exists IV
|
||||
if flag == "<%= ENV['AES_IV'] %>"
|
||||
# Export for Key
|
||||
|
||||
@@ -74,10 +74,10 @@ class License
|
||||
|
||||
|
||||
def detail_with_local_file()
|
||||
has_license = true #verify_license()
|
||||
has_license = verify_license()
|
||||
|
||||
if has_license
|
||||
# puts "VERIFIED"
|
||||
puts "VERIFIED"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,9 +103,10 @@ class License
|
||||
return response
|
||||
end
|
||||
|
||||
def verify_license
|
||||
api_token = read_license("api_token")
|
||||
@params = { query: {lookup_type: "application", token: api_token} }
|
||||
def verify_license
|
||||
api_token = read_license_no_decrypt("api_token")
|
||||
puts api_token
|
||||
@params = { query: {lookup_type: "application", api_token: api_token} }
|
||||
response = self.class.get("/verify", @params)
|
||||
@varified = response.parsed_response
|
||||
|
||||
@@ -121,7 +122,8 @@ class License
|
||||
end
|
||||
|
||||
# Check License expired date from PROVISION SERVER
|
||||
def check_expired(renewal_date)
|
||||
def check_expired(renewal_date_str)
|
||||
renewal_date = DateTime.parse(renewal_date_str)
|
||||
if (renewal_date < Date.today)
|
||||
return true
|
||||
else
|
||||
@@ -148,6 +150,20 @@ class License
|
||||
return decrypted_line
|
||||
end
|
||||
|
||||
# read line by key for license file without decrypt
|
||||
def read_license_no_decrypt(key)
|
||||
decrypted_line = ""
|
||||
if File.exist?("config/license.yml")
|
||||
File.open("config/license.yml").each do |line|
|
||||
if line.include? (key)
|
||||
decrypted_line_array = line.split(": ")
|
||||
decrypted_line = decrypted_line_array[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
return decrypted_line
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def decode_str(str)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
iv_key: agEa1OwWkfL1+PCpyc5L2w==
|
||||
shop_name: Su7XJ/AcJsTuOc9e7LzYJQ==
|
||||
iv_key: A30HZdW+iDZA0vM5PAqwgg==
|
||||
shop_name: 7DdPBxVo8m1xpa5T2kIcWQ==
|
||||
email: yanaung.nyein@code2lab.com
|
||||
telephone: 111111
|
||||
fax: 111111
|
||||
address: bitp
|
||||
dbhost: ZUvBchuta4JY25yjJPGLYA==
|
||||
dbschema: hNFEe1KXQ+CZqGuQ+c6v0w==
|
||||
dbusername: pNJSbFV5EFOI6pOnVC84eA==
|
||||
dbpassword: ON655p46MfQvkqVMYOXzBA==
|
||||
dbhost: 9+83FZetcbLZi6COG5PbSw==
|
||||
dbschema: shztSYIsNmM9nlHkR/4exQ==
|
||||
dbusername: LapN+Geriht8yk866FxNiQ==
|
||||
dbpassword: QtboWZ4ATE05vvYw6J+Uqw==
|
||||
api_token: nGyMizHtoVEFYCjSVEFJuzkxuBJwSsH
|
||||
app_token: QUdPwSakcsnuVLdfkXgGHhPMiIOcSSfaVwQyA
|
||||
|
||||
Reference in New Issue
Block a user