Defect #35731

Password and Confirmation fields are marked as required when editing a user

Added by Go MAEDA about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Administration
Target version:4.1.5
Resolution:Fixed Affected version:

Description

Password and Confirmation are marked as required in UsersController#edit page. However, in actuality, those fields are only required when creating a new user, not when editing a user.

One of my customers misunderstood that the fields are required and they always set a new password when they edit a user's information.

"*" marks that indicate Password and Confirmation fields are required should be removed when editing a user in order to avoid such confusion.

marked-as-required.png (62 KB) Go MAEDA, 2021-08-11 07:30

35731.patch Magnifier (1.9 KB) Go MAEDA, 2021-08-11 10:20

Associated revisions

Revision 21167
Added by Go MAEDA about 1 month ago

Password and Confirmation fields are marked as required when editing a user (#35731).

Patch by Go MAEDA.

Revision 21168
Added by Go MAEDA about 1 month ago

Merged r21167 from trunk to 4.2-stable (#35731).

Revision 21169
Added by Go MAEDA about 1 month ago

Merged r21167 from trunk to 4.1-stable (#35731).

History

#1 Updated by Go MAEDA about 1 month ago

The following patch fixes the issue.

diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 4b030d920..0d50d3d56 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -32,13 +32,13 @@
   <% 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>

#2 Updated by Go MAEDA about 1 month ago

  • File 35731.patchMagnifier added
  • Target version set to Candidate for next minor release

Added test code.

#3 Updated by Holger Just about 1 month ago

Looks good to me. Thanks!

#4 Updated by Go MAEDA about 1 month ago

  • Target version changed from Candidate for next minor release to 4.1.5

Setting the target version to 4.1.5.

#5 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch.

Also available in: Atom PDF