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>