Project

General

Profile

Feature #41937 ยป 41937.patch

Go MAEDA, 2024-12-05 06:42

View differences:

app/views/account/login.html.erb
5 5
  <%= back_url_hidden_field_tag %>
6 6
  
7 7
  <label for="username"><%=l(:field_login)%></label>
8
  <%= text_field_tag 'username', params[:username], :tabindex => '1', :autofocus => params[:username].blank? %>
8
  <%= text_field_tag 'username', params[:username], :tabindex => '1', :autocomplete => 'username', :autofocus => params[:username].blank? %>
9 9
  
10 10
  <label for="password">
11 11
    <%=l(:field_password)%>
12 12
    <%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
13 13
  </label>
14
  <%= password_field_tag 'password', nil, :tabindex => '2', :autofocus => params[:username].present? %>
14
  <%= password_field_tag 'password', nil, :tabindex => '2', :autocomplete => 'current-password', :autofocus => params[:username].present? %>
15 15
  
16 16
  <% if Setting.autologin? %>
17 17
    <label for="autologin"><%= check_box_tag 'autologin', 1, false, :tabindex => 4 %> <%= l(:label_stay_logged_in) %></label>
app/views/account/password_recovery.html.erb
7 7
  <div class="box tabular">
8 8
    <p>
9 9
      <label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
10
      <%= password_field_tag 'new_password', nil, :size => 25 %>
10
      <%= password_field_tag 'new_password', nil, :size => 25, :autocomplete => 'new-password' %>
11 11
      <em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
12 12
      <% if Setting.password_required_char_classes.any? %>
13 13
        <em class="info"><%= l(:text_characters_must_contain, :character_classes => Setting.password_required_char_classes.collect{|c| l("label_password_char_class_#{c}")}.join(", ")) %></em>
......
16 16

  
17 17
    <p>
18 18
      <label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
19
      <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
19
      <%= password_field_tag 'new_password_confirmation', nil, :size => 25, :autocomplete => 'new-password' %>
20 20
    </p>
21 21
  </div>
22 22
  <p><%= submit_tag l(:button_save) %></p>
app/views/my/password.html.erb
5 5
<%= form_tag({}, :class => "tabular") do %>
6 6
<div class="box">
7 7
<p><label for="password"><%=l(:field_current_password)%> <span class="required">*</span></label>
8
<%= password_field_tag 'password', nil, :size => 25 %></p>
8
<%= password_field_tag 'password', nil, :size => 25, :autocomplete => 'current-password' %></p>
9 9

  
10 10
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
11
<%= password_field_tag 'new_password', nil, :size => 25 %>
11
<%= password_field_tag 'new_password', nil, :size => 25, :autocomplete => 'new-password' %>
12 12
  <em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
13 13
  <% if Setting.password_required_char_classes.any? %>
14 14
    <em class="info"><%= l(:text_characters_must_contain, :character_classes => Setting.password_required_char_classes.collect{|c| l("label_password_char_class_#{c}")}.join(", ")) %></em>
......
16 16
</p>
17 17

  
18 18
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
19
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
19
<%= password_field_tag 'new_password_confirmation', nil, :size => 25, :autocomplete => 'new-password' %></p>
20 20
</div>
21 21
<%= submit_tag l(:button_apply) %>
22 22
<% end %>
app/views/sudo_mode/_new_modal.html.erb
8 8
  <div class="box tabular">
9 9
    <p>
10 10
      <label for="sudo_password"><%= l :field_password %><span class="required">*</span></label>
11
      <%= password_field_tag :sudo_password, nil, size: 25 %>
11
      <%= password_field_tag :sudo_password, nil, size: 25, :autocomplete => 'current-password' %>
12 12
      <br/><%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
13 13
    </p>
14 14
  </div>
app/views/sudo_mode/new.html.erb
8 8
  <div class="box">
9 9
    <p>
10 10
      <label for="sudo_password"><%= l :field_password %><span class="required">*</span></label>
11
      <%= password_field_tag :sudo_password, nil, size: 25, autofocus: true %>
11
      <%= password_field_tag :sudo_password, nil, size: 25, :autocomplete => 'current-password', autofocus: true %>
12 12
      </br><%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
13 13
    </p>
14 14
  </div>
test/functional/account_controller_test.rb
30 30
    get :login
31 31
    assert_response :success
32 32

  
33
    assert_select 'input[name=username]'
34
    assert_select 'input[name=password]'
33
    assert_select 'input[name=username][autocomplete=username]'
34
    assert_select 'input[name=password][autocomplete=current-password]'
35 35
  end
36 36

  
37 37
  def test_get_login_while_logged_in_should_redirect_to_back_url_if_present
test/functional/my_controller_test.rb
605 605
  def test_change_password
606 606
    get :password
607 607
    assert_response :success
608
    assert_select 'input[type=password][name=password]'
609
    assert_select 'input[type=password][name=new_password]'
610
    assert_select 'input[type=password][name=new_password_confirmation]'
608
    assert_select 'input[type=password][name=password][autocomplete=current-password]'
609
    assert_select 'input[type=password][name=new_password][autocomplete=new-password]'
610
    assert_select 'input[type=password][name=new_password_confirmation][autocomplete=new-password]'
611 611
  end
612 612

  
613 613
  def test_update_password
test/integration/account_test.rb
136 136
    follow_redirect!
137 137
    assert_response :success
138 138
    assert_select 'input[type=hidden][name=token][value=?]', token.value
139
    assert_select 'input[name=new_password]'
140
    assert_select 'input[name=new_password_confirmation]'
139
    assert_select 'input[name=new_password][autocomplete=new-password]'
140
    assert_select 'input[name=new_password_confirmation][autocomplete=new-password]'
141 141

  
142 142
    post(
143 143
      "/account/lost_password",
    (1-1/1)