From a992e724fb3a7309dfc307e0e52a46382a52e809 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Fri, 13 Aug 2021 02:59:28 +0000 Subject: [PATCH] Merged r21167 from trunk to 4.2-stable (#35731). git-svn-id: http://svn.redmine.org/redmine/branches/4.2-stable@21168 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/users/_form.html.erb | 4 ++-- test/functional/users_controller_test.rb | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) 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 %>

- <%= f.password_field :password, :required => true, :size => 25 %> + <%= f.password_field :password, :required => @user.new_record?, :size => 25 %> <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %> <% if Setting.password_required_char_classes.any? %> <%= l(:text_characters_must_contain, :character_classes => Setting.password_required_char_classes.collect{|c| l("label_password_char_class_#{c}")}.join(", ")) %> <% end %>

-

<%= f.password_field :password_confirmation, :required => true, :size => 25 %>

+

<%= f.password_field :password_confirmation, :required => @user.new_record?, :size => 25 %>

<%= f.check_box :generate_password %>

<%= f.check_box :must_change_passwd %>

diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 15e8cf2ea..6f1ea7474 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -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 @@ -484,6 +485,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 -- 2.39.5