diff --git a/core/lib/generators/spree/install/templates/config/initializers/spree.rb.tt b/core/lib/generators/spree/install/templates/config/initializers/spree.rb.tt index 04175bda306..cd898b70b32 100644 --- a/core/lib/generators/spree/install/templates/config/initializers/spree.rb.tt +++ b/core/lib/generators/spree/install/templates/config/initializers/spree.rb.tt @@ -93,3 +93,11 @@ Spree.user_class = <%= (options[:user_class].blank? ? "Spree::LegacyUser" : opti # just uncomment the following code and change it as you need. # # Spree::Model.whitelisted_ransackable_attributes << 'field' + +# Rules for avoiding to store the current path into session for redirects +# When at least one rule is matched, the request path will not be stored +# in session. +# You can add your custom rules by uncommenting this line and changing +# the class name: +# +# Spree::UserReturnToStorer.rules << 'Spree::UrlReturnToStorer::Rules::AuthenticationRule' diff --git a/core/lib/spree/core/controller_helpers/auth.rb b/core/lib/spree/core/controller_helpers/auth.rb index 5f2bec80cc8..0b0476e7434 100644 --- a/core/lib/spree/core/controller_helpers/auth.rb +++ b/core/lib/spree/core/controller_helpers/auth.rb @@ -50,19 +50,7 @@ def set_guest_token end def store_location - # disallow return to login, logout, signup pages - authentication_routes = [:spree_signup_path, :spree_login_path, :spree_logout_path] - disallowed_urls = [] - authentication_routes.each do |route| - if respond_to?(route) - disallowed_urls << send(route) - end - end - - disallowed_urls.map!{ |url| url[/\/\w+$/] } - unless disallowed_urls.include?(request.fullpath) - session['spree_user_return_to'] = request.fullpath.gsub('//', '/') - end + Spree::UserReturnToStorer.new(self).store_location end # proxy method to *possible* spree_current_user method