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