]> source.dussan.org Git - redmine.git/commitdiff
Reverted r10234 and r10235 that broke redirect after login (#11691).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 26 Aug 2012 09:29:48 +0000 (09:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 26 Aug 2012 09:29:48 +0000 (09:29 +0000)
Tests in account_controller_test.rb should not have been changed.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10238 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/application_controller.rb
app/controllers/users_controller.rb
app/views/users/index.html.erb
test/functional/account_controller_test.rb

index 0e5f6ba543965199a92f51859a02f8ce2dc2f75a..d6efa412423030ad5f8135a3c8d2a1523b896d00 100644 (file)
@@ -300,7 +300,7 @@ class ApplicationController < ActionController::Base
   end
 
   def redirect_back_or_default(default)
-    back_url = params[:back_url].to_s
+    back_url = CGI.unescape(params[:back_url].to_s)
     if !back_url.blank?
       begin
         uri = URI.parse(back_url)
index da6f6ae28971927b09a7f686dc69d214f817811f..a56371c5f8f479cfef0ad8b9dc0e0aa145ed5c24 100644 (file)
@@ -174,7 +174,7 @@ class UsersController < ApplicationController
   def destroy
     @user.destroy
     respond_to do |format|
-      format.html { redirect_back_or_default(users_url) }
+      format.html { redirect_to_referer_or(users_url) }
       format.api  { render_api_ok }
     end
   end
index f88b5231e2f8bb73b4a144fa831326a183f614e0..a477a5c90abe0cfd802246949a4cb83c3dff0799 100644 (file)
@@ -46,7 +46,7 @@
   <td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
     <td class="buttons">
       <%= change_status_link(user) %>
-      <%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %>
+      <%= delete_link user_path(user) unless User.current == user %>
     </td>
   </tr>
 <% end -%>
index 7b5a449e5b6ff17b3a3d7d81f60cbcf45aaae278..f48e4b3a62a9f72c1a8bf5bcca31b0c89957b05f 100644 (file)
@@ -33,12 +33,12 @@ class AccountControllerTest < ActionController::TestCase
 
   def test_login_should_redirect_to_back_url_param
     # request.uri is "test.host" in test environment
-    post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.host/issues/show/1'
+    post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.host%2Fissues%2Fshow%2F1'
     assert_redirected_to '/issues/show/1'
   end
 
   def test_login_should_not_redirect_to_another_host
-    post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.foo/fake'
+    post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.foo%2Ffake'
     assert_redirected_to '/my/page'
   end