many important fixes

This commit is contained in:
2020-02-29 11:43:00 -05:00
parent 2149345d3d
commit 73c207c324
28 changed files with 1463 additions and 242 deletions
@@ -6,10 +6,12 @@ module Users
private
def user_authentication
if params[:auth_token].present?
user = User.find_by_authentication_token(params[:auth_token])
sign_in user if user
sign_out current_user if current_user && !user # Other token attempt of logged in user
auth_token = params[:auth_token].presence || request.headers['HTTP_AUTH_TOKEN'].presence
if auth_token.present?
user = User.find_by_authentication_token(auth_token)
#sign_out current_user if current_user && !user # Other token attempt of logged in user
bypass_sign_in user if user
elsif request.format.html?
return if Rails.env.test? and action_name == 'index'
authenticate_user!
@@ -39,6 +41,7 @@ module Users
case params[:product_orders]
when String then JSON.parse(params[:product_orders]) rescue []
when Hash then params[:product_orders].values
when Array then params[:product_orders]
else
[]
end