diff -ur redmine-0.9.3/app/controllers/account_controller.rb redmine/app/controllers/account_controller.rb --- redmine-0.9.3/app/controllers/account_controller.rb 2010-02-28 13:28:06.000000000 +0300 +++ redmine/app/controllers/account_controller.rb 2010-04-20 08:10:39.403029646 +0400 @@ -150,6 +150,7 @@ def open_id_authenticate(openid_url) + cookies[:back_url] = { :value => CGI.unescape(params[:back_url].to_s) } unless params[:open_id_complete] authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration| if result.successful? user = User.find_or_initialize_by_identity_url(identity_url) diff -ur redmine-0.9.3/app/controllers/application_controller.rb redmine/app/controllers/application_controller.rb --- redmine-0.9.3/app/controllers/application_controller.rb 2010-02-28 13:28:06.000000000 +0300 +++ redmine/app/controllers/application_controller.rb 2010-04-20 08:10:39.404033104 +0400 @@ -177,6 +177,10 @@ def redirect_back_or_default(default) back_url = CGI.unescape(params[:back_url].to_s) + if back_url.blank? + back_url = cookies[:back_url] + cookies.delete :back_url + end if !back_url.blank? begin uri = URI.parse(back_url) diff -ur redmine-0.9.3/test/functional/account_controller_test.rb redmine/test/functional/account_controller_test.rb --- redmine-0.9.3/test/functional/account_controller_test.rb 2010-02-28 13:28:05.000000000 +0300 +++ redmine/test/functional/account_controller_test.rb 2010-04-20 08:49:39.123404798 +0400 @@ -67,6 +67,20 @@ assert_redirected_to 'my/page' end + def test_login_should_redirect_to_back_url_param_with_openid + Setting.self_registration = '3' + Setting.openid = '1' + existing_user = User.new(:firstname => 'Cool', + :lastname => 'User', + :mail => 'user@somedomain.com', + :identity_url => 'http://openid.example.com/good_user') + existing_user.login = 'cool_user' + assert existing_user.save! + + post :login, :openid_url => existing_user.identity_url, :back_url => 'http%3A%2F%2Ftest.host%2Fissues%2Fshow%2F1' + assert_redirected_to '/issues/show/1' + end + def test_login_with_openid_for_existing_non_active_user Setting.self_registration = '2' Setting.openid = '1'