<%= content_tag :div, data: { controller: 'disable-when-checked', 'admin--users-target': 'passwordFields' }, hidden: !@user.change_password_allowed? do %> <% assign_random_password_enabled = params[:user] && params[:user][:assign_random_password] %>
<%= styled_label_tag 'user_assign_random_password', I18n.t(:assign_random_password, scope: :user) %>
<%= styled_check_box_tag "user[assign_random_password]", "1", assign_random_password_enabled, data: { 'disable-when-checked-target': 'cause' } %>
<% unless OpenProject::Configuration.disable_password_choice? %>
<%= f.password_field :password, required: @user.new_record?, disabled: assign_random_password_enabled, data: { 'disable-when-checked-target': 'effect' }, container_class: '-middle' %>
<%= password_complexity_requirements %>
<%= f.password_field :password_confirmation, required: @user.new_record?, disabled: assign_random_password_enabled, data: { 'disable-when-checked-target': 'effect' }, container_class: '-middle' %>
<% end %> <% if @user.active? -%>
<%= styled_label_tag 'send_information', t(:label_send_information) %>
<%= styled_check_box_tag("send_information", "1", true) %>
<% end -%>
<%= f.check_box :force_password_change, disabled: assign_random_password_enabled %>
<% end %>