Preserve username when authentification failed (#11846).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10609 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5344a35f72
commit
3e706adddd
@ -5,7 +5,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><label for="username"><%=l(:field_login)%>:</label></td>
|
<td align="right"><label for="username"><%=l(:field_login)%>:</label></td>
|
||||||
<td align="left"><%= text_field_tag 'username', nil, :tabindex => '1' %></td>
|
<td align="left"><%= text_field_tag 'username', params[:username], :tabindex => '1' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><label for="password"><%=l(:field_password)%>:</label></td>
|
<td align="right"><label for="password"><%=l(:field_password)%>:</label></td>
|
||||||
@ -36,7 +36,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<%= javascript_tag "$('#username').focus();" %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<%= call_hook :view_account_login_bottom %>
|
<%= call_hook :view_account_login_bottom %>
|
||||||
|
|
||||||
|
<% if params[:username].present? %>
|
||||||
|
<%= javascript_tag "$('#password').focus();" %>
|
||||||
|
<% else %>
|
||||||
|
<%= javascript_tag "$('#username').focus();" %>
|
||||||
|
<% end %>
|
||||||
|
@ -31,6 +31,15 @@ class AccountControllerTest < ActionController::TestCase
|
|||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get_login
|
||||||
|
get :login
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'login'
|
||||||
|
|
||||||
|
assert_select 'input[name=username]'
|
||||||
|
assert_select 'input[name=password]'
|
||||||
|
end
|
||||||
|
|
||||||
def test_login_should_redirect_to_back_url_param
|
def test_login_should_redirect_to_back_url_param
|
||||||
# request.uri is "test.host" in test environment
|
# request.uri is "test.host" in test environment
|
||||||
post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.host/issues/show/1'
|
post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.host/issues/show/1'
|
||||||
@ -46,9 +55,11 @@ class AccountControllerTest < ActionController::TestCase
|
|||||||
post :login, :username => 'admin', :password => 'bad'
|
post :login, :username => 'admin', :password => 'bad'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'login'
|
assert_template 'login'
|
||||||
assert_tag 'div',
|
|
||||||
:attributes => { :class => "flash error" },
|
assert_select 'div.flash.error', :text => /Invalid user or password/
|
||||||
:content => /Invalid user or password/
|
assert_select 'input[name=username][value=admin]'
|
||||||
|
assert_select 'input[name=password]'
|
||||||
|
assert_select 'input[name=password][value]', 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_login_should_rescue_auth_source_exception
|
def test_login_should_rescue_auth_source_exception
|
||||||
|
Loading…
x
Reference in New Issue
Block a user