Revision 1521:2354ddf5a483
| app/controllers/account_controller.rb | ||
|---|---|---|
| 39 | 39 |
else |
| 40 | 40 |
authenticate_user |
| 41 | 41 |
end |
| 42 |
rescue AuthSourceException => e |
|
| 42 |
rescue AuthSource::AuthSourceException => e
|
|
| 43 | 43 |
logger.error "An error occured when authenticating #{params[:username]}: #{e.message}"
|
| 44 | 44 |
render_error :message => e.message |
| 45 | 45 |
end |
| app/controllers/application_controller.rb | ||
|---|---|---|
| 377 | 377 |
def redirect_back_or_default(default, options={})
|
| 378 | 378 |
back_url = params[:back_url].to_s |
| 379 | 379 |
if back_url.present? && valid_back_url?(back_url) |
| 380 |
begin |
|
| 381 |
uri = URI.parse(back_url) |
|
| 382 |
# do not redirect user to another host or to the login or register page |
|
| 383 |
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
|
| 380 | 384 |
# soundsoftware: if back_url is the home page, |
| 381 | 385 |
# change it to My Page (#125) |
| 382 | 386 |
if (uri.path == home_path) |
| ... | ... | |
| 392 | 396 |
uri.scheme = "https" |
| 393 | 397 |
end |
| 394 | 398 |
back_url = uri.to_s |
| 395 |
redirect_to(back_url) |
|
| 396 |
return |
|
| 399 |
redirect_to(back_url) |
|
| 400 |
return |
|
| 401 |
end |
|
| 402 |
rescue URI::InvalidURIError |
|
| 403 |
logger.warn("Could not redirect to invalid URL #{back_url}")
|
|
| 404 |
# redirect to default |
|
| 405 |
end |
|
| 397 | 406 |
elsif options[:referer] |
| 398 | 407 |
redirect_to_referer_or default |
| 399 | 408 |
return |
Also available in: Unified diff