]> source.dussan.org Git - redmine.git/commitdiff
Password and Confirmation fields are marked as required when editing a user (#35731).
authorGo MAEDA <maeda@farend.jp>
Fri, 13 Aug 2021 02:56:04 +0000 (02:56 +0000)
committerGo MAEDA <maeda@farend.jp>
Fri, 13 Aug 2021 02:56:04 +0000 (02:56 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@21167 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/users/_form.html.erb
test/functional/users_controller_test.rb

index 4b030d92056ff43759bb130d01047e5d84a3bcb3..0d50d3d56d711d2556a7b1e400d4be125041e99d 100644 (file)
   <% end %>
   <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
   <p>
-    <%= f.password_field :password, :required => true, :size => 25  %>
+    <%= f.password_field :password, :required => @user.new_record?, :size => 25  %>
     <em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
     <% if Setting.password_required_char_classes.any? %>
       <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>
     <% end %>
   </p>
-  <p><%= f.password_field :password_confirmation, :required => true, :size => 25  %></p>
+  <p><%= f.password_field :password_confirmation, :required => @user.new_record?, :size => 25  %></p>
   <p><%= f.check_box :generate_password %></p>
   <p><%= f.check_box :must_change_passwd %></p>
   </div>
index 4dae5138fafb7f6c608fb93cea73e5f82a2c4c99..247d81120bc9b2618a2bf36d034512bccab9e0dc 100644 (file)
@@ -280,6 +280,7 @@ class UsersControllerTest < Redmine::ControllerTest
     get :new
     assert_response :success
     assert_select 'input[name=?]', 'user[login]'
+    assert_select 'label[for=?]>span.required', 'user_password', 1
   end
 
   def test_create
@@ -482,6 +483,7 @@ class UsersControllerTest < Redmine::ControllerTest
     assert_response :success
     assert_select 'h2>a+img.gravatar'
     assert_select 'input[name=?][value=?]', 'user[login]', 'jsmith'
+    assert_select 'label[for=?]>span.required', 'user_password', 0
   end
 
   def test_edit_registered_user