doemal or other api token added
This commit is contained in:
@@ -32,7 +32,7 @@ class Api::ApiController < ActionController::API
|
|||||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||||
# authenticate_session_token
|
# authenticate_session_token
|
||||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||||
else8
|
else
|
||||||
# reconnect_default_db
|
# reconnect_default_db
|
||||||
logger.info 'License is nil'
|
logger.info 'License is nil'
|
||||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ module TokenVerification
|
|||||||
authenticate_token || render_unauthorized
|
authenticate_token || render_unauthorized
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_token
|
def authenticate_token
|
||||||
authenticate_with_http_token do |token, options|
|
authenticate_with_http_token do |token, options|
|
||||||
# Rails.logger.debug "token - " + token.to_s
|
# Rails.logger.debug "token - " + token.to_s
|
||||||
if(!options.from.nil? && options.from == "DOEMAL"){
|
if(options.length !=0 && options["from"] == "DOEMAL")
|
||||||
if(ENV["SERVER_MODE"] === "cloud"){
|
if(ENV["SERVER_MODE"] === "cloud")
|
||||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||||
aes = MyAesCrypt.new
|
aes = MyAesCrypt.new
|
||||||
return aes.checkKeyForAuth(from, token)
|
return aes.checkKeyForAuth(from, token)
|
||||||
}
|
end
|
||||||
}
|
end
|
||||||
|
|
||||||
@user = Employee.authenticate_by_token(token)
|
@user = Employee.authenticate_by_token(token)
|
||||||
if @user
|
if @user
|
||||||
|
|||||||
@@ -56,20 +56,20 @@ class MyAesCrypt
|
|||||||
return aes_key, aes_iv
|
return aes_key, aes_iv
|
||||||
end
|
end
|
||||||
|
|
||||||
def checkKeyForAuth(from,token){
|
def checkKeyForAuth(from,token)
|
||||||
file_path = "config/shops.json"
|
file_path = "config/shops.json"
|
||||||
shop_data = File.read(file_path)
|
shop_data = File.read(file_path)
|
||||||
|
|
||||||
shop_json = JSON.parse(shop_data)
|
shop_json = JSON.parse(shop_data)
|
||||||
shop_json["data"].each do |j|
|
shop_json["data"].each do |j|
|
||||||
if j["lookup"] == from
|
if j["lookup"] == from
|
||||||
if(j["value"]["key"] == token){
|
if(j["value"]["key"] == token)
|
||||||
return true
|
return true
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
}
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def encrypt(data)
|
def encrypt(data)
|
||||||
|
|||||||
@@ -429,7 +429,7 @@
|
|||||||
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
|
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
|
||||||
<input type="hidden" name="filename" id="filename">
|
<input type="hidden" name="filename" id="filename">
|
||||||
<input type="hidden" name="printer_name" id="printer_name">
|
<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>
|
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class ActionController::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def lookup_domain
|
def lookup_domain
|
||||||
if request.subdomain.present? && request.subdomain != "www"
|
if request.subdomain.present? && request.subdomain != "www"
|
||||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||||
@@ -20,11 +20,11 @@ class ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
#check for license file
|
#check for license file
|
||||||
if check_license
|
# if check_license
|
||||||
current_license(ENV["SX_PROVISION_URL"])
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
else
|
# else
|
||||||
redirect_to activate_path
|
# redirect_to activate_path
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -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==
|
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
sx_provision_url: https://connect.pos-myanmar.com/bensai/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||||
server_mode: application
|
server_mode: cloud
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"data": [
|
"data": [
|
||||||
{
|
{
|
||||||
|
"lookup": "local",
|
||||||
|
"value": {
|
||||||
|
"key": "999d675168d813d5e1c7",
|
||||||
|
"iv": "999d675168d813d5e1c7"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user