@@ -63,9 +63,9 class ApplicationController < ActionController::Base | |||||
63 | if session[:user_id] |
|
63 | if session[:user_id] | |
64 | if session_expired? && !try_to_autologin |
|
64 | if session_expired? && !try_to_autologin | |
65 | set_localization(User.active.find_by_id(session[:user_id])) |
|
65 | set_localization(User.active.find_by_id(session[:user_id])) | |
66 | reset_session |
|
66 | self.logged_user = nil | |
67 | flash[:error] = l(:error_session_expired) |
|
67 | flash[:error] = l(:error_session_expired) | |
68 |
re |
|
68 | require_login | |
69 | else |
|
69 | else | |
70 | session[:atime] = Time.now.utc.to_i |
|
70 | session[:atime] = Time.now.utc.to_i | |
71 | end |
|
71 | end |
@@ -56,14 +56,14 class SessionsTest < ActionController::TestCase | |||||
56 | def test_user_session_without_ctime_should_be_reset_if_lifetime_enabled |
|
56 | def test_user_session_without_ctime_should_be_reset_if_lifetime_enabled | |
57 | with_settings :session_lifetime => '720' do |
|
57 | with_settings :session_lifetime => '720' do | |
58 | get :index, {}, {:user_id => 2} |
|
58 | get :index, {}, {:user_id => 2} | |
59 | assert_redirected_to '/login' |
|
59 | assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' | |
60 | end |
|
60 | end | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | def test_user_session_with_expired_ctime_should_be_reset_if_lifetime_enabled |
|
63 | def test_user_session_with_expired_ctime_should_be_reset_if_lifetime_enabled | |
64 | with_settings :session_timeout => '720' do |
|
64 | with_settings :session_timeout => '720' do | |
65 | get :index, {}, {:user_id => 2, :atime => 2.days.ago.utc.to_i} |
|
65 | get :index, {}, {:user_id => 2, :atime => 2.days.ago.utc.to_i} | |
66 | assert_redirected_to '/login' |
|
66 | assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' | |
67 | end |
|
67 | end | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
@@ -77,14 +77,14 class SessionsTest < ActionController::TestCase | |||||
77 | def test_user_session_without_atime_should_be_reset_if_timeout_enabled |
|
77 | def test_user_session_without_atime_should_be_reset_if_timeout_enabled | |
78 | with_settings :session_timeout => '60' do |
|
78 | with_settings :session_timeout => '60' do | |
79 | get :index, {}, {:user_id => 2} |
|
79 | get :index, {}, {:user_id => 2} | |
80 | assert_redirected_to '/login' |
|
80 | assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' | |
81 | end |
|
81 | end | |
82 | end |
|
82 | end | |
83 |
|
83 | |||
84 | def test_user_session_with_expired_atime_should_be_reset_if_timeout_enabled |
|
84 | def test_user_session_with_expired_atime_should_be_reset_if_timeout_enabled | |
85 | with_settings :session_timeout => '60' do |
|
85 | with_settings :session_timeout => '60' do | |
86 | get :index, {}, {:user_id => 2, :atime => 4.hours.ago.utc.to_i} |
|
86 | get :index, {}, {:user_id => 2, :atime => 4.hours.ago.utc.to_i} | |
87 | assert_redirected_to '/login' |
|
87 | assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' | |
88 | end |
|
88 | end | |
89 | end |
|
89 | end | |
90 |
|
90 | |||
@@ -117,7 +117,7 class SessionsTest < ActionController::TestCase | |||||
117 |
|
117 | |||
118 | with_settings :session_timeout => '60' do |
|
118 | with_settings :session_timeout => '60' do | |
119 | get :index, {}, {:user_id => user.id, :atime => 4.hours.ago.utc.to_i} |
|
119 | get :index, {}, {:user_id => user.id, :atime => 4.hours.ago.utc.to_i} | |
120 | assert_redirected_to '/login' |
|
120 | assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' | |
121 | assert_include "Veuillez vous reconnecter", flash[:error] |
|
121 | assert_include "Veuillez vous reconnecter", flash[:error] | |
122 | assert_equal :fr, current_language |
|
122 | assert_equal :fr, current_language | |
123 | end |
|
123 | end |
General Comments 0
You need to be logged in to leave comments.
Login now