Commit e571c718b07a43b810239eadce872f903756417d
Exists in
master
and in
29 other branches
Merge branch 'remote_user_loggout_fix' into 'master'
Remote user loggout fix Fix the Remote User Plugin Logout See merge request !364
Showing
2 changed files
with
17 additions
and
1 deletions
Show diff stats
plugins/remote_user/lib/remote_user_plugin.rb
@@ -14,7 +14,7 @@ class RemoteUserPlugin < Noosfero::Plugin | @@ -14,7 +14,7 @@ class RemoteUserPlugin < Noosfero::Plugin | ||
14 | begin | 14 | begin |
15 | remote_user = request.headers["HTTP_REMOTE_USER"] | 15 | remote_user = request.headers["HTTP_REMOTE_USER"] |
16 | 16 | ||
17 | - if remote_user.nil? | 17 | + if remote_user.blank? |
18 | if logged_in? | 18 | if logged_in? |
19 | self.current_user.forget_me | 19 | self.current_user.forget_me |
20 | reset_session | 20 | reset_session |
plugins/remote_user/test/functional/remote_user_plugin_test.rb
@@ -71,4 +71,20 @@ class AccountControllerTest < ActionController::TestCase | @@ -71,4 +71,20 @@ class AccountControllerTest < ActionController::TestCase | ||
71 | assert_equal true, User.last.activated? | 71 | assert_equal true, User.last.activated? |
72 | assert_equal User.last.id, session[:user] | 72 | assert_equal User.last.id, session[:user] |
73 | end | 73 | end |
74 | + | ||
75 | + should 'logout if there is a current logged user but not a remote user' do | ||
76 | + user1 = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test') | ||
77 | + user1.activate | ||
78 | + | ||
79 | + login_as user1.login | ||
80 | + | ||
81 | + get :index | ||
82 | + | ||
83 | + assert session[:user].blank? | ||
84 | + | ||
85 | + @request.env["HTTP_REMOTE_USER"] = "" | ||
86 | + get :index | ||
87 | + | ||
88 | + assert session[:user].blank? | ||
89 | + end | ||
74 | end | 90 | end |