doemal or other api token added

This commit is contained in:
Yan
2018-04-11 17:20:17 +06:30
parent 53388248e9
commit b730c78afe
8 changed files with 26 additions and 37 deletions

View File

@@ -32,7 +32,7 @@ class Api::ApiController < ActionController::API
ActiveRecord::Base.establish_connection(website_connection(@license))
# authenticate_session_token
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
else8
else
# reconnect_default_db
logger.info 'License is nil'
# redirect_to root_url(:host => request.domain) + "store_error"

View File

@@ -13,16 +13,16 @@ module TokenVerification
authenticate_token || render_unauthorized
end
def authenticate_token
authenticate_with_http_token do |token, options|
def authenticate_token
authenticate_with_http_token do |token, options|
# Rails.logger.debug "token - " + token.to_s
if(!options.from.nil? && options.from == "DOEMAL"){
if(ENV["SERVER_MODE"] === "cloud"){
from = request.subdomain.downcase + "." + request.domain.downcase
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
from = request.subdomain.downcase + "." + request.domain.downcase
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
}
}
end
end
@user = Employee.authenticate_by_token(token)
if @user

View File

@@ -56,20 +56,20 @@ class MyAesCrypt
return aes_key, aes_iv
end
def checkKeyForAuth(from,token){
def checkKeyForAuth(from,token)
file_path = "config/shops.json"
shop_data = File.read(file_path)
shop_json = JSON.parse(shop_data)
shop_json["data"].each do |j|
if j["lookup"] == from
if(j["value"]["key"] == token){
if(j["value"]["key"] == token)
return true
}
end
end
end
return false
}
end
private
def encrypt(data)

View File

@@ -429,7 +429,7 @@
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name">
<div class="text-center">
<div class="text-center">
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
</div>
</div>

View File

@@ -3,7 +3,7 @@ class ActionController::Base
private
def lookup_domain
def lookup_domain
if request.subdomain.present? && request.subdomain != "www"
from = request.subdomain.downcase + "." + request.domain.downcase
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
@@ -20,11 +20,11 @@ class ActionController::Base
end
else
#check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
end
end

View File

@@ -1,15 +0,0 @@
iv_key: rwOZKWcQho6fE4V+A2zFuQ==
shop_name: AMZ_Test
email: aungmyo.zaw@code2lab.com
telephone:
fax:
address:
dbhost: dNzh66R80remB694OEds96OpuyZ4wmHeHFdQh0KwjYFvTInK6+pCN/y6HdbyIlqqjcBHkqPjkjzw45PznLn7hA==
dbschema: 4vooJDxgWdFv/8V7Qx8tzR/8B8T2c5U4XvYcF+2KOoA=
dbusername: Xc8ELRsW7N/f8KsVikMBlg==
dbpassword: HMg+TbLxmfYrDFI4IIAd4g==
api_token: bisryXiEnbTJlZwghAnIByQpiRUMouu
app_token: LycQXJYBZGeCygjIEKdlBXnjIGMiMzgmt
plan_sku: 84hdnSCgkfhvItY7uB/pPQ==
renewable_date: 8E6Ecz8QXAMSlKZnIzn0pQ==
plan_name: 4cMIO0n/JzGFPIccXM6u5A==

View File

@@ -12,8 +12,8 @@
development:
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
server_mode: application
sx_provision_url: https://connect.pos-myanmar.com/bensai/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
server_mode: cloud
cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L

View File

@@ -1,7 +1,11 @@
{
"data": [
{
"lookup": "local",
"value": {
"key": "999d675168d813d5e1c7",
"iv": "999d675168d813d5e1c7"
}
}
]
}