changeset 365:7d8567890fa3 feature_125

Redirect to My Page instead if asked to redirect to home page
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 01 Apr 2011 12:11:13 +0100
parents 7a616ddc3331
children 3e8c33cbb8e0 055518fc4e4c dff13616e464
files app/controllers/application_controller.rb
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/application_controller.rb	Fri Apr 01 12:03:41 2011 +0100
+++ b/app/controllers/application_controller.rb	Fri Apr 01 12:11:13 2011 +0100
@@ -263,12 +263,17 @@
         uri = URI.parse(back_url)
         # do not redirect user to another host or to the login or register page
         if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
+          # soundsoftware: if back_url is the home page,
+          # change it to My Page (#125)
+          if (uri.path == home_path)
+            uri.path = uri.path + "/my"
+          end
           # soundsoftware: if login page is https but back_url http,
           # switch back_url to https to ensure cookie validity (#83)
           if (uri.scheme == "http") && (URI.parse(request.url).scheme == "https")
             uri.scheme = "https"
-            back_url = uri.to_s
           end
+          back_url = uri.to_s
           redirect_to(back_url)
           return
         end