remove skip auth from api and check user modified

This commit is contained in:
Yan
2018-04-09 09:58:22 +06:30
parent 1811e53dd1
commit cb3f9c4cd7
7 changed files with 17 additions and 14 deletions

View File

@@ -1,5 +1,4 @@
class Api::Restaurant::ItemSetsController < Api::ApiController class Api::Restaurant::ItemSetsController < Api::ApiController
#Description #Description
# Pull the default menu details and also other available (active) menus # Pull the default menu details and also other available (active) menus
# Input Params - order_id # Input Params - order_id

View File

@@ -1,5 +1,4 @@
class Api::Restaurant::MenuCategoriesController < Api::ApiController class Api::Restaurant::MenuCategoriesController < Api::ApiController
skip_before_action :authenticate
#Description #Description
# Pull the default menu details and also other available (active) menus # Pull the default menu details and also other available (active) menus
# Input Params - order_id # Input Params - order_id

View File

@@ -1,5 +1,4 @@
class Api::Restaurant::MenuController < Api::ApiController class Api::Restaurant::MenuController < Api::ApiController
skip_before_action :authenticate
#Description #Description
# Pull the default menu details and also other available (active) menus # Pull the default menu details and also other available (active) menus
# Input Params - order_id # Input Params - order_id

View File

@@ -1,5 +1,4 @@
class Api::Restaurant::MenuItemAttributesController < Api::ApiController class Api::Restaurant::MenuItemAttributesController < Api::ApiController
skip_before_action :authenticate
#Description #Description
# Pull the default menu details and also other available (active) menus # Pull the default menu details and also other available (active) menus
# Input Params - order_id # Input Params - order_id

View File

@@ -1,5 +1,4 @@
class Api::Restaurant::MenuItemInstancesController < Api::ApiController class Api::Restaurant::MenuItemInstancesController < Api::ApiController
skip_before_action :authenticate
#Description #Description
# Pull the default menu details and also other available (active) menus # Pull the default menu details and also other available (active) menus
# Input Params - order_id # Input Params - order_id

View File

@@ -16,10 +16,18 @@ class BaseOrigamiController < ActionController::Base
end end
def check_user def check_user
if check_mobile
if current_user.nil?
return render status: 401, json: {
message: "User using other device!"
}.to_json
end
else
if current_user.nil? if current_user.nil?
redirect_to root_path redirect_to root_path
end end
end end
end
# def checkin_process # def checkin_process
# CheckinJob.set(wait: 1.minute).perform_later() # CheckinJob.set(wait: 1.minute).perform_later()
@@ -41,9 +49,9 @@ class BaseOrigamiController < ActionController::Base
authenticate_with_http_token do |token, options| authenticate_with_http_token do |token, options|
if token if token
session[:webview] = true session[:webview] = true
end
session[:session_token] = token session[:session_token] = token
end end
end
if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i
status = true status = true