Login link unexpected logs you out (#12611).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11122 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d56f916a0e
commit
7c2490c6fc
|
@ -25,7 +25,9 @@ class AccountController < ApplicationController
|
|||
# Login request and validation
|
||||
def login
|
||||
if request.get?
|
||||
logout_user
|
||||
if User.current.logged?
|
||||
redirect_to home_url
|
||||
end
|
||||
else
|
||||
authenticate_user
|
||||
end
|
||||
|
|
|
@ -33,6 +33,14 @@ class AccountControllerTest < ActionController::TestCase
|
|||
assert_select 'input[name=password]'
|
||||
end
|
||||
|
||||
def test_get_login_while_logged_in_should_redirect_to_home
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
get :login
|
||||
assert_redirected_to '/'
|
||||
assert_equal 2, @request.session[:user_id]
|
||||
end
|
||||
|
||||
def test_login_should_redirect_to_back_url_param
|
||||
# request.uri is "test.host" in test environment
|
||||
post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.host/issues/show/1'
|
||||
|
|
Loading…
Reference in New Issue