diff --git a/app/assets/javascripts/app/lib/app_post/auth.coffee b/app/assets/javascripts/app/lib/app_post/auth.coffee index 5bc41409c..6ccc72ec0 100644 --- a/app/assets/javascripts/app/lib/app_post/auth.coffee +++ b/app/assets/javascripts/app/lib/app_post/auth.coffee @@ -163,8 +163,10 @@ class App.Auth App.Event.trigger('auth') App.Event.trigger('auth:logout') if rerender - window.location.href = '#login' - App.Event.trigger('ui:rerender') + @loginCheck(-> + window.location.href = '#login' + App.Event.trigger('ui:rerender') + ) App.Event.trigger('clearStore') @_loginError: -> diff --git a/spec/system/basic/authentication_spec.rb b/spec/system/basic/authentication_spec.rb index b8147c8e1..1d90f93d4 100644 --- a/spec/system/basic/authentication_spec.rb +++ b/spec/system/basic/authentication_spec.rb @@ -15,4 +15,14 @@ RSpec.describe 'Authentication', type: :system do logout expect_current_route 'login', wait: 2 end + + it 'will unset user attributes after logout' do + logout + expect_current_route 'login', wait: 2 + + visit '/#signup' + + # check wrong displayed fields in registration form after logout. #2989 + page.should_not have_selector('select[name=organization_id]') + end end