Mercurial > hg > soundsoftware-site
comparison app/controllers/application_controller.rb @ 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 | 4b1a23d81683 |
children | 350acce374a2 dff13616e464 |
comparison
equal
deleted
inserted
replaced
364:7a616ddc3331 | 365:7d8567890fa3 |
---|---|
261 if !back_url.blank? | 261 if !back_url.blank? |
262 begin | 262 begin |
263 uri = URI.parse(back_url) | 263 uri = URI.parse(back_url) |
264 # do not redirect user to another host or to the login or register page | 264 # do not redirect user to another host or to the login or register page |
265 if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) | 265 if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) |
266 # soundsoftware: if back_url is the home page, | |
267 # change it to My Page (#125) | |
268 if (uri.path == home_path) | |
269 uri.path = uri.path + "/my" | |
270 end | |
266 # soundsoftware: if login page is https but back_url http, | 271 # soundsoftware: if login page is https but back_url http, |
267 # switch back_url to https to ensure cookie validity (#83) | 272 # switch back_url to https to ensure cookie validity (#83) |
268 if (uri.scheme == "http") && (URI.parse(request.url).scheme == "https") | 273 if (uri.scheme == "http") && (URI.parse(request.url).scheme == "https") |
269 uri.scheme = "https" | 274 uri.scheme = "https" |
270 back_url = uri.to_s | |
271 end | 275 end |
276 back_url = uri.to_s | |
272 redirect_to(back_url) | 277 redirect_to(back_url) |
273 return | 278 return |
274 end | 279 end |
275 rescue URI::InvalidURIError | 280 rescue URI::InvalidURIError |
276 # redirect to default | 281 # redirect to default |