cehck mobile
This commit is contained in:
@@ -16,8 +16,23 @@ class BaseOrigamiController < ActionController::Base
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
token_status = false
|
||||
authenticate_with_http_token do |token, options|
|
||||
if token
|
||||
token_status = true
|
||||
session[:webview] = true
|
||||
session[:session_token] = token
|
||||
end
|
||||
end
|
||||
|
||||
if token_status
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
else
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,13 +53,9 @@ class BaseOrigamiController < ActionController::Base
|
||||
#check webview
|
||||
def check_mobile
|
||||
status = false
|
||||
authenticate_with_http_token do |token, options|
|
||||
if token
|
||||
session[:webview] = true
|
||||
end
|
||||
session[:session_token] = token
|
||||
end
|
||||
|
||||
puts "check mobile"
|
||||
puts session[:session_token]
|
||||
puts session[:webview]
|
||||
if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i
|
||||
status = true
|
||||
end
|
||||
|
||||
@@ -7,7 +7,6 @@ class Origami::HomeController < BaseOrigamiController
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
|
||||
Reference in New Issue
Block a user