From 02fe2e57cc503514ec1900c2bc5dc12c3d3e91e0 Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 3 May 2018 09:29:18 +0630 Subject: [PATCH 1/3] no changes --- app/controllers/concerns/token_verification.rb | 3 +-- config/initializers/action_controller.rb | 4 ++-- config/secrets.yml | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/concerns/token_verification.rb b/app/controllers/concerns/token_verification.rb index 85c9b858..b49ef597 100755 --- a/app/controllers/concerns/token_verification.rb +++ b/app/controllers/concerns/token_verification.rb @@ -24,8 +24,7 @@ module TokenVerification end end - @user = Employee. - (token) + @user = Employee.authenticate_by_token(token) if @user return true #Maybe log - login? diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index a3b19ebe..b84bca54 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -8,7 +8,7 @@ class ActionController::Base from = request.subdomain.downcase + "." + request.domain.downcase @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase if (!@license.nil?) - logger.info "Location - " + @license.dbhost + logger.info "Location - " + @license.dbschema ActiveRecord::Base.establish_connection(website_connection(@license)) # authenticate_session_token # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema @@ -97,7 +97,7 @@ class ActionController::API from = request.subdomain.downcase + "." + request.domain.downcase @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase if (!@license.nil?) - # logger.info "Location - " + @license.dbhost + logger.info "Location - " + @license.dbschema ActiveRecord::Base.establish_connection(website_connection(@license)) # authenticate_session_token # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema diff --git a/config/secrets.yml b/config/secrets.yml index b0d7c5c8..218234f1 100755 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -13,7 +13,7 @@ development: secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61 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 + server_mode: application cipher_type: AES-256-CBC sx_key: Wh@t1$C2L From b0377afb8f3411cd54f8a4be760cc8baf1b9c06d Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 3 May 2018 17:53:34 +0630 Subject: [PATCH 2/3] no change --- app/controllers/base_origami_controller.rb | 2 +- app/controllers/origami/other_charges_controller.rb | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 66cc2880..0c01a735 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -15,7 +15,7 @@ class BaseOrigamiController < ActionController::Base redirect_to origami_dashboard_path end - def check_user + def check_user if check_mobile if current_user.nil? return render status: 401, json: { diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index 28ab2c06..4b94990b 100755 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -15,12 +15,11 @@ class Origami::OtherChargesController < BaseOrigamiController @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) else @table = nil - end - + end end end - def create + def create sale_id = params[:sale_id] other_charges_items = JSON.parse(params[:other_charges_items]) sub_total = params[:sub_total] @@ -79,8 +78,6 @@ class Origami::OtherChargesController < BaseOrigamiController if !table.nil? dining = {:table_id => table_id, :table_type => table.type } render :json => dining.to_json - end - - end - + end + end end \ No newline at end of file From 44ac3bcd0cfef8d0f533c7841b72c39d9416977b Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 4 May 2018 11:14:54 +0630 Subject: [PATCH 3/3] no change base origami --- app/controllers/base_origami_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 0c01a735..7ca3b9f9 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -5,7 +5,7 @@ class BaseOrigamiController < ActionController::Base before_action :check_user #before_action :check_installation - protect_from_forgery with: :exception + protect_from_forgery with: :exception helper_method :shop_detail, :current_token