diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d378a694..14838c20 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,8 +23,8 @@ class ApplicationController < ActionController::Base end def lookup_domain - if request.subdomain.present? && request.subdomain != "www" - @license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase) + # if request.subdomain.present? && request.subdomain != "www" + @license = current_license(ENV["SX_PROVISION_URL"], "chromis") # request.subdomain.downcase if (!@license.nil?) # logger.info "Location - " + @license.name ActiveRecord::Base.establish_connection(website_connection(@license)) @@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base # redirect_to root_url(:host => request.domain) + "store_error" render :json => [{ status: false, message: 'Invalid Access!'}] end - end + # end end def current_license(url, subdomain) diff --git a/app/models/AESEncDec.rb b/app/models/AESEncDec.rb index e175a3a9..0a8be5de 100644 --- a/app/models/AESEncDec.rb +++ b/app/models/AESEncDec.rb @@ -5,6 +5,10 @@ require 'uri' class AESEncDec { cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc") + def initialize + + end + 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_iv'] = cipher.iv = cipher.random_iv # stores the iv in iv, and also sets the generated iv on the cipher diff --git a/app/models/license.rb b/app/models/license.rb index 537e1221..53cc81ba 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -1,7 +1,7 @@ class License 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, :plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections, @@ -20,8 +20,8 @@ class License end # generate key for license file encrypt - AESCrypt.export_key() - + AESEncDec.export_key() +byebug @secret = ENV["aes_key"] @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } } end diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 845c3a95..9b9d3a2e 100755 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -42,16 +42,14 @@ <% if table.status == 'occupied' %> <% if table.get_booking.nil? %>