@@ -5,7 +5,7 | |||
|
5 | 5 | <table> |
|
6 | 6 | <tr> |
|
7 | 7 | <td align="right"><label for="username"><%=l(:field_login)%>:</label></td> |
|
8 |
<td align="left"><%= text_field_tag 'username', |
|
|
8 | <td align="left"><%= text_field_tag 'username', params[:username], :tabindex => '1' %></td> | |
|
9 | 9 | </tr> |
|
10 | 10 | <tr> |
|
11 | 11 | <td align="right"><label for="password"><%=l(:field_password)%>:</label></td> |
@@ -36,7 +36,12 | |||
|
36 | 36 | </td> |
|
37 | 37 | </tr> |
|
38 | 38 | </table> |
|
39 | <%= javascript_tag "$('#username').focus();" %> | |
|
40 | 39 | <% end %> |
|
41 | 40 | </div> |
|
42 | 41 | <%= call_hook :view_account_login_bottom %> |
|
42 | ||
|
43 | <% if params[:username].present? %> | |
|
44 | <%= javascript_tag "$('#password').focus();" %> | |
|
45 | <% else %> | |
|
46 | <%= javascript_tag "$('#username').focus();" %> | |
|
47 | <% end %> |
@@ -31,6 +31,15 class AccountControllerTest < ActionController::TestCase | |||
|
31 | 31 | User.current = nil |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | def test_get_login | |
|
35 | get :login | |
|
36 | assert_response :success | |
|
37 | assert_template 'login' | |
|
38 | ||
|
39 | assert_select 'input[name=username]' | |
|
40 | assert_select 'input[name=password]' | |
|
41 | end | |
|
42 | ||
|
34 | 43 | def test_login_should_redirect_to_back_url_param |
|
35 | 44 | # request.uri is "test.host" in test environment |
|
36 | 45 | post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.host/issues/show/1' |
@@ -46,9 +55,11 class AccountControllerTest < ActionController::TestCase | |||
|
46 | 55 | post :login, :username => 'admin', :password => 'bad' |
|
47 | 56 | assert_response :success |
|
48 | 57 | assert_template 'login' |
|
49 | assert_tag 'div', | |
|
50 | :attributes => { :class => "flash error" }, | |
|
51 | :content => /Invalid user or password/ | |
|
58 | ||
|
59 | assert_select 'div.flash.error', :text => /Invalid user or password/ | |
|
60 | assert_select 'input[name=username][value=admin]' | |
|
61 | assert_select 'input[name=password]' | |
|
62 | assert_select 'input[name=password][value]', 0 | |
|
52 | 63 | end |
|
53 | 64 | |
|
54 | 65 | def test_login_should_rescue_auth_source_exception |
General Comments 0
You need to be logged in to leave comments.
Login now