current shop
This commit is contained in:
@@ -25,16 +25,16 @@ module LoginVerification
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session_and_shop_code(session[:session_token],@current_shop.shop_code)
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session_and_shop_code(session[:session_token],@current_shop.shop_code) if session[:session_token]
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
# Get current Cashiers
|
||||
def get_cashier
|
||||
@cashier = Employee.where("shop_code='#{@current_shop.shop_code}' and role = 'cashier' AND token_session <> ''")
|
||||
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
end
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ module LoginVerification
|
||||
|
||||
#check order reservation used
|
||||
def order_reservation
|
||||
order_reserve = Lookup.where("shop_code='#{@current_shop.shop_code}'").collection_of('order_reservation')
|
||||
order_reserve = Lookup.collection_of('order_reservation')
|
||||
status = false
|
||||
if !order_reserve.empty?
|
||||
order_reserve.each do |order|
|
||||
@@ -61,7 +61,7 @@ module LoginVerification
|
||||
|
||||
#check bank integration used
|
||||
def bank_integration
|
||||
bank_integration = Lookup.where("shop_code='#{@current_shop.shop_code}'").collection_of('bank_integration')
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
status = false
|
||||
if !bank_integration.empty?
|
||||
bank_integration.each do |bank|
|
||||
@@ -86,7 +86,7 @@ module LoginVerification
|
||||
if (token)
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
#Rails.logger.debug "token - " + token.to_s
|
||||
@user = Employee.authenticate_by_token(token,@current_shop)
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
@@ -94,21 +94,6 @@ module LoginVerification
|
||||
end
|
||||
end
|
||||
|
||||
def authenticate_session_token
|
||||
shop_code = 262
|
||||
if (shop_code)
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
#Rails.logger.debug "token - " + token.to_s
|
||||
@current_shop = Shop.find_by_shop_code(shop_code)
|
||||
if @current_shop
|
||||
return true
|
||||
#Maybe log - login?
|
||||
end
|
||||
else
|
||||
@current_shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
def render_unauthorized
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user