From 43948e7bcc2f20abec074821edcc821962d68720 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 3 Mar 2015 10:14:57 +0100 Subject: [PATCH] Do not remember #login and #logout as requested url. --- .../controllers/_application_controller.js.coffee | 5 ++++- .../app/controllers/_settings/area.js.coffee | 6 ++++-- .../javascripts/app/controllers/login.js.coffee | 2 +- lib/sso/env.rb | 2 +- lib/sso/otrs.rb | 2 +- test/browser/setting_test.rb | 12 ++++++++++++ .../browser/signup_password_change_and_reset_test.rb | 2 +- test/browser_test_helper.rb | 5 +++-- 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index d641dfe31..2ba35483d 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -189,7 +189,10 @@ class App.Controller extends Spine.Controller return true if @Session.get() # remember requested url - @Config.set( 'requested_url', window.location.hash ) + if !checkOnly + location = window.location.hash + if location isnt '#login' && location isnt '#logout' + @Config.set( 'requested_url', location) return false if checkOnly diff --git a/app/assets/javascripts/app/controllers/_settings/area.js.coffee b/app/assets/javascripts/app/controllers/_settings/area.js.coffee index 703ebfc45..0613eac4b 100644 --- a/app/assets/javascripts/app/controllers/_settings/area.js.coffee +++ b/app/assets/javascripts/app/controllers/_settings/area.js.coffee @@ -82,10 +82,12 @@ class App.SettingsAreaItem extends App.Controller App.Event.trigger 'notify', { type: 'success' msg: App.i18n.translateContent('Update successful!') - timeout: 1500 + timeout: 2000 } ui.render() - #App.Event.trigger( 'ui:rerender' ) + + App.Event.trigger( 'ui:rerender' ) + # login check App.Auth.loginCheck() ) diff --git a/app/assets/javascripts/app/controllers/login.js.coffee b/app/assets/javascripts/app/controllers/login.js.coffee index e28d766f3..fd616b921 100644 --- a/app/assets/javascripts/app/controllers/login.js.coffee +++ b/app/assets/javascripts/app/controllers/login.js.coffee @@ -92,7 +92,7 @@ class Index extends App.ControllerContent # redirect to # requested_url = @Config.get( 'requested_url' ) - if requested_url && requested_url isnt '#login' + if requested_url && requested_url isnt '#login' && requested_url isnt '#logout' @log 'notice', "REDIRECT to '#{requested_url}'" @navigate requested_url diff --git a/lib/sso/env.rb b/lib/sso/env.rb index 633658ced..46cd3f915 100644 --- a/lib/sso/env.rb +++ b/lib/sso/env.rb @@ -14,6 +14,6 @@ module Sso::Env return user if user end - return false + false end end \ No newline at end of file diff --git a/lib/sso/otrs.rb b/lib/sso/otrs.rb index 7b1c3e442..068bf83aa 100644 --- a/lib/sso/otrs.rb +++ b/lib/sso/otrs.rb @@ -24,6 +24,6 @@ module Sso::Otrs return end - return user + user end end \ No newline at end of file diff --git a/test/browser/setting_test.rb b/test/browser/setting_test.rb index 21e8c9995..abb1a676b 100644 --- a/test/browser/setting_test.rb +++ b/test/browser/setting_test.rb @@ -11,6 +11,18 @@ class SettingTest < TestCase ) tasks_close_all() + # make sure, that we have english frontend + click( :css => 'a[href="#current_user"]' ) + click( :css => 'a[href="#profile"]' ) + click( :css => 'a[href="#profile/language"]' ) + select( + :css => '.language_item select[name="locale"]', + :value => 'English (United States)', + ) + click( :css => '.content button[type="submit"]' ) + sleep 2 + + # change settings click( :css => 'a[href="#manage"]' ) click( :css => 'a[href="#settings/security"]' ) click( :css => 'a[href="#third_party_auth"]' ) diff --git a/test/browser/signup_password_change_and_reset_test.rb b/test/browser/signup_password_change_and_reset_test.rb index 988a05302..efde3658a 100644 --- a/test/browser/signup_password_change_and_reset_test.rb +++ b/test/browser/signup_password_change_and_reset_test.rb @@ -125,8 +125,8 @@ class SignupPasswordChangeAndResetTest < TestCase :value => 'Password changed successfully', ) logout() - sleep 4 + # check login with new pw login( :username => signup_user_email, :password => 'some-pass-new2', diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 2a2564fc0..724c979b9 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -130,6 +130,7 @@ class TestCase < Test::Unit::TestCase sleep 0.1 instance.find_elements( { :css => 'a[href="#logout"]' } )[0].click (1..6).each {|loop| + sleep 1 login = instance.find_elements( { :css => '#login' } )[0] if login assert( true, "logout ok" ) @@ -637,7 +638,7 @@ class TestCase < Test::Unit::TestCase if params[:timeout] timeout = params[:timeout] end - loops = (timeout).to_i * 2 + loops = (timeout).to_i text = '' (1..loops).each { |loop| element = instance.find_elements( { :css => params[:css] } )[0] @@ -661,7 +662,7 @@ class TestCase < Test::Unit::TestCase # just try again end end - sleep 0.5 + sleep 1 } raise "'#{params[:value]}' found in '#{text}'" end