<% 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>
get :new
assert_response :success
assert_select 'input[name=?]', 'user[login]'
+ assert_select 'label[for=?]>span.required', 'user_password', 1
end
def test_create
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