]> source.dussan.org Git - redmine.git/commitdiff
Merged r14245 (#19655).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 May 2015 07:21:39 +0000 (07:21 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 May 2015 07:21:39 +0000 (07:21 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.0-stable@14249 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/application_controller.rb
test/functional/sessions_test.rb

index e52cc6186ed6476c9d0b9b4e40be3d6eac3ef27c..6e2136836cd74866d5eb1f6b226dc3b9d8dbd05c 100644 (file)
@@ -63,9 +63,9 @@ class ApplicationController < ActionController::Base
     if session[:user_id]
       if session_expired? && !try_to_autologin
         set_localization(User.active.find_by_id(session[:user_id]))
-        reset_session
+        self.logged_user = nil
         flash[:error] = l(:error_session_expired)
-        redirect_to signin_url
+        require_login
       else
         session[:atime] = Time.now.utc.to_i
       end
index 1d75fc8dbe79a3a4a7c074960c8ca33e1c08809e..9e70326825cb7d6c8ed6f10d0a9d0f71a852fcc0 100644 (file)
@@ -56,14 +56,14 @@ class SessionsTest < ActionController::TestCase
   def test_user_session_without_ctime_should_be_reset_if_lifetime_enabled
     with_settings :session_lifetime => '720' do
       get :index, {}, {:user_id => 2}
-      assert_redirected_to '/login'
+      assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
     end
   end
 
   def test_user_session_with_expired_ctime_should_be_reset_if_lifetime_enabled
     with_settings :session_timeout => '720' do
       get :index, {}, {:user_id => 2, :atime => 2.days.ago.utc.to_i}
-      assert_redirected_to '/login'
+      assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
     end
   end
 
@@ -77,14 +77,14 @@ class SessionsTest < ActionController::TestCase
   def test_user_session_without_atime_should_be_reset_if_timeout_enabled
     with_settings :session_timeout => '60' do
       get :index, {}, {:user_id => 2}
-      assert_redirected_to '/login'
+      assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
     end
   end
 
   def test_user_session_with_expired_atime_should_be_reset_if_timeout_enabled
     with_settings :session_timeout => '60' do
       get :index, {}, {:user_id => 2, :atime => 4.hours.ago.utc.to_i}
-      assert_redirected_to '/login'
+      assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
     end
   end
 
@@ -117,7 +117,7 @@ class SessionsTest < ActionController::TestCase
 
     with_settings :session_timeout => '60' do
       get :index, {}, {:user_id => user.id, :atime => 4.hours.ago.utc.to_i}
-      assert_redirected_to '/login'
+      assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
       assert_include "Veuillez vous reconnecter", flash[:error]
       assert_equal :fr, current_language
     end