Permalink
Browse files

Add authentication routes to disallowed_routes in store_location, only

if they exist
  • Loading branch information...
1 parent c86e12a commit 5fe4ce71250ee70e729218e48053673e17b26bf9 @radar radar committed May 30, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 core/lib/spree/core/controller_helpers.rb
@@ -55,7 +55,14 @@ def current_ability
def store_location
# disallow return to login, logout, signup pages
- disallowed_urls = [spree_signup_path, spree_login_path, spree_logout_path]
+ authentication_routes = [:spree_signup_path, :spree_login_path, :spree_logout_path]
+ disallowed_urls = []
+ authenticated_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['user_return_to'] = request.fullpath.gsub('//', '/')

0 comments on commit 5fe4ce7

Please sign in to comment.