license test
This commit is contained in:
@@ -23,8 +23,8 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def lookup_domain
|
def lookup_domain
|
||||||
if request.subdomain.present? && request.subdomain != "www"
|
# if request.subdomain.present? && request.subdomain != "www"
|
||||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
@license = current_license(ENV["SX_PROVISION_URL"], "chromis") # request.subdomain.downcase
|
||||||
if (!@license.nil?)
|
if (!@license.nil?)
|
||||||
# logger.info "Location - " + @license.name
|
# logger.info "Location - " + @license.name
|
||||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||||
@@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
|
|||||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||||
end
|
end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_license(url, subdomain)
|
def current_license(url, subdomain)
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ require 'uri'
|
|||||||
class AESEncDec {
|
class AESEncDec {
|
||||||
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def self.export_key
|
def self.export_key
|
||||||
ENV['aes_key'] = cipher.key = cipher.random_key # stores the key in key, and also sets the generated key on the cipher
|
ENV['aes_key'] = cipher.key = cipher.random_key # stores the key in key, and also sets the generated key on the cipher
|
||||||
ENV['aes_iv'] = cipher.iv = cipher.random_iv # stores the iv in iv, and also sets the generated iv on the cipher
|
ENV['aes_iv'] = cipher.iv = cipher.random_iv # stores the iv in iv, and also sets the generated iv on the cipher
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class License
|
class License
|
||||||
include HTTParty
|
include HTTParty
|
||||||
|
|
||||||
base_uri "secure.smartsales.asia/api"
|
base_uri "provision.zsai.ws/api"
|
||||||
|
|
||||||
attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain,
|
attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain,
|
||||||
:plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections,
|
:plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections,
|
||||||
@@ -20,8 +20,8 @@ class License
|
|||||||
end
|
end
|
||||||
|
|
||||||
# generate key for license file encrypt
|
# generate key for license file encrypt
|
||||||
AESCrypt.export_key()
|
AESEncDec.export_key()
|
||||||
|
byebug
|
||||||
@secret = ENV["aes_key"]
|
@secret = ENV["aes_key"]
|
||||||
@params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
@params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
<% if table.get_booking.nil? %>
|
<% if table.get_booking.nil? %>
|
||||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.get_booking %>
|
|
||||||
Zone <%= table.zone_id %> <br>
|
Zone <%= table.zone_id %> <br>
|
||||||
Table <%= table.name %> ( <%= table.seater %> Seat )
|
Table <%= table.name %> ( <%= table.seater %> Seat )
|
||||||
</div>
|
</div>
|
||||||
@@ -51,7 +50,6 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<div class="card tables blue text-white" data-id="<%= table.id %>">
|
<div class="card tables blue text-white" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.get_booking %>
|
|
||||||
Zone <%= table.zone_id %> <br>
|
Zone <%= table.zone_id %> <br>
|
||||||
Table <%= table.name %> ( <%= table.seater %> Seat )
|
Table <%= table.name %> ( <%= table.seater %> Seat )
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: secure.smartsales.asia/api
|
sx_provision_url: 192.168.1.94:3002/api #provision.zsai.ws
|
||||||
aes_key: <%= ENV['aes_key'] %>
|
aes_key: <%= ENV['aes_key'] %>
|
||||||
aes_iv: <%= ENV['aes_iv'] %>
|
aes_iv: <%= ENV['aes_iv'] %>
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ test:
|
|||||||
# instead read values from the environment.
|
# instead read values from the environment.
|
||||||
production:
|
production:
|
||||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||||
sx_provision_url: secure.smartsales.asia/api
|
sx_provision_url: 192.168.1.94:3002/api #provision.zsai.ws
|
||||||
aes_key: <%= ENV['aes_key'] %>
|
aes_key: <%= ENV['aes_key'] %>
|
||||||
aes_iv: <%= ENV['aes_iv'] %>
|
aes_iv: <%= ENV['aes_iv'] %>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace :clear do
|
|||||||
ShiftSale.delete_all
|
ShiftSale.delete_all
|
||||||
PaymentJournal.delete_all
|
PaymentJournal.delete_all
|
||||||
DiningFacility.update_all(status:'available')
|
DiningFacility.update_all(status:'available')
|
||||||
CashierTerminal.update_all(is_currently_login: 1)
|
CashierTerminal.update_all(is_currently_login: 0)
|
||||||
puts "Clear Data Done."
|
puts "Clear Data Done."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user