update license

This commit is contained in:
Thein Lin Kyaw
2020-06-19 10:46:52 +06:30
parent 02ba0f21e6
commit 7e9b4f7120
32 changed files with 387 additions and 393 deletions

View File

@@ -2,7 +2,8 @@ module LoginVerification
extend ActiveSupport::Concern
included do
before_action :authenticate_session_token
before_action :authenticate
puts "LoginVerification"
helper_method :current_company, :current_shop, :current_login_employee, :current_user, :get_cashier, :order_reservation, :bank_integration, :shop_detail
end
@@ -86,7 +87,7 @@ module LoginVerification
token = session[:session_token]
if (token)
#@current_user = User.find_by(api_key: token)
#Rails.logger.debug "token - " + token.to_s
# Rails.logger.debug "token - " + token.to_s
@user = Employee.authenticate_by_token(token)
if @user
@@ -97,6 +98,6 @@ module LoginVerification
end
def render_unauthorized
redirect_to root_path
redirect_to login_path
end
end

View File

@@ -3,17 +3,32 @@ module MultiTenancy
included do
set_current_tenant_through_filter if respond_to? :set_current_tenant_through_filter
before_action :find_shop_by_subdomain_or_frist if respond_to? :before_action
before_action :set_current_tenant_by_subdomain_or_name if respond_to? :before_action
helper_method :current_shop if respond_to? :helper_method
end
private
def find_shop_by_subdomain_or_frist
if request.subdomain.present?
shop_code = request.subdomain.partition('-').last
shop = Shop.find_by(shop_code: shop_code)
else
shop = Shop.first
def set_current_tenant_by_subdomain_or_name
find_tenant_by_subdomain_or_name || not_found
end
def find_tenant_by_subdomain_or_name
if request.subdomains.last && request.subdomains.last != "www"
shop_code = request.subdomains.last.partition('-').last
set_current_tenant(Shop.find_by(shop_code: shop_code))
elsif Shop.count == 1
set_current_tenant(Shop.first)
end
set_current_tenant(shop)
end
def not_found
respond_to do |format|
format.html { render :file => "#{Rails.root}/public/404", :layout => false, :status => :not_found }
format.json { head :not_found }
end
end
def current_shop
ActsAsTenant.current_tenant
end
end