-
-
Save edavis10/74b2c35f9b998830b4858ef66218cb3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < ApplicationController | |
include ShopifyApp::SessionsController | |
before_filter :check_allowed_shops, only: :new | |
private | |
# Checks that the shop attempting to login (starting OAuth flow) is allowed | |
def check_allowed_shops | |
if params[:shop].present? | |
if allowed_shops.include?(params[:shop].gsub(".myshopify.com","")) | |
return true # Allowed | |
else | |
redirect_to login_path | |
return false | |
end | |
end | |
end | |
# Domains of shops to allow. | |
# | |
# The myshopify.com subdomain without the myshopify.com part | |
def allowed_shops | |
["shop1","shop2","shop3"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment