From 39e6dbe05ae02f791a6993f88ec65adb59911311 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Wed, 25 Mar 2020 11:46:19 +0100 Subject: [PATCH] Fixes #2640 - Signup view broken after logout. --- app/assets/javascripts/app/lib/app_post/auth.coffee | 6 ++++-- spec/system/basic/authentication_spec.rb | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) 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