GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit dc070752 authored by jplang's avatar jplang

Login link unexpected logs you out (#12611).

git-svn-id: https://svn.redmine.org/redmine/trunk@11122 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent d8fa7102
......@@ -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'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment