Sha256: a17419ba2b35ff276dc72c1fb0b54aeed08c92384c6b52715b82d4f55fa99a49
Contents?: true
Size: 893 Bytes
Versions: 34
Compression:
Stored size: 893 Bytes
Contents
# frozen_string_literal: true module ShopifyApp module RequireKnownShop extend ActiveSupport::Concern included do before_action :check_shop_domain before_action :check_shop_known end def current_shopify_domain return if params[:shop].blank? @shopify_domain ||= ShopifyApp::Utils.sanitize_shop_domain(params[:shop]) end private def check_shop_domain redirect_to(ShopifyApp.configuration.login_url) unless current_shopify_domain end def check_shop_known @shop = SessionRepository.retrieve_shop_session_by_shopify_domain(current_shopify_domain) redirect_to(shop_login) unless @shop end def shop_login url = URI(ShopifyApp.configuration.login_url) url.query = URI.encode_www_form( shop: params[:shop], return_to: request.fullpath, ) url.to_s end end end
Version data entries
34 entries across 34 versions & 1 rubygems