Project

General

Profile

Defect #35731 » 35731.patch

Go MAEDA, 2021-08-11 10:20

View differences:

app/views/users/_form.html.erb
32 32
  <% end %>
33 33
  <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
34 34
  <p>
35
    <%= f.password_field :password, :required => true, :size => 25  %>
35
    <%= f.password_field :password, :required => @user.new_record?, :size => 25  %>
36 36
    <em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
37 37
    <% if Setting.password_required_char_classes.any? %>
38 38
      <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>
39 39
    <% end %>
40 40
  </p>
41
  <p><%= f.password_field :password_confirmation, :required => true, :size => 25  %></p>
41
  <p><%= f.password_field :password_confirmation, :required => @user.new_record?, :size => 25  %></p>
42 42
  <p><%= f.check_box :generate_password %></p>
43 43
  <p><%= f.check_box :must_change_passwd %></p>
44 44
  </div>
test/functional/users_controller_test.rb
280 280
    get :new
281 281
    assert_response :success
282 282
    assert_select 'input[name=?]', 'user[login]'
283
    assert_select 'label[for=?]>span.required', 'user_password', 1
283 284
  end
284 285

  
285 286
  def test_create
......
482 483
    assert_response :success
483 484
    assert_select 'h2>a+img.gravatar'
484 485
    assert_select 'input[name=?][value=?]', 'user[login]', 'jsmith'
486
    assert_select 'label[for=?]>span.required', 'user_password', 0
485 487
  end
486 488

  
487 489
  def test_edit_registered_user
(2-2/2)