diff app/controllers/application_controller.rb @ 247:73ff0e6a11b1 cannam

* Merge from branch cannam-pre-20110113-merge
author Chris Cannam
date Thu, 03 Mar 2011 12:11:53 +0000
parents b859cc0c4fa1 4b1a23d81683
children 753f1380d6bc
line wrap: on
line diff
--- a/app/controllers/application_controller.rb	Thu Mar 03 12:02:03 2011 +0000
+++ b/app/controllers/application_controller.rb	Thu Mar 03 12:11:53 2011 +0000
@@ -263,6 +263,12 @@
         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 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
           redirect_to(back_url)
           return
         end