<%= error_messages_for 'user' %>
<%=l(:label_information_plural)%>

<%= f.text_field :login, :required => true, :size => 25 %>

<%= f.text_field :firstname, :required => true %>

<%= f.text_field :lastname, :required => true %>

<%= f.text_field :mail, :required => true %>

<% unless @user.force_default_language? %>

<%= f.select :language, lang_options_for_select %>

<% end %> <% @user.custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :user, value %>

<% end %>

<%= f.check_box :admin, :disabled => (@user == User.current) %>

<%= call_hook(:view_users_form, :user => @user, :form => f) %>
<%=l(:label_authentication)%> <% unless @auth_sources.empty? %>

<%= f.select :auth_source_id, ([[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] }), {}, :onchange => "if (this.value=='') {$('#password_fields').show();} else {$('#password_fields').hide();}" %>

<% end %>

<%= 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 => @user.new_record?, :size => 25 %>

<%= f.check_box :generate_password %>

<%= f.check_box :must_change_passwd %>

<% if Setting.twofa? && !@user.new_record? -%>

<% if @user.twofa_active? %> <%=l 'twofa_currently_active', twofa_scheme_name: l("twofa__#{@user.twofa_scheme}__name") -%>
<% if @user == User.current # administrators cannot deactivate their own 2FA without confirmation code %> <%= link_to l('button_disable'), { controller: 'twofa', action: 'deactivate_init', scheme: @user.twofa_scheme }, method: :post -%> <% else %> <%= link_to l('button_disable'), { controller: 'twofa', action: 'admin_deactivate', user_id: @user }, method: :post -%> <% end %> <% else %> <%=l 'twofa_not_active' %> <% end %>

<% end -%>
<%=l(:field_mail_notification)%> <%= render :partial => 'users/mail_notifications' %>
<%=l(:label_auto_watch_on)%> <%= render :partial => 'users/auto_watch_on' %>
<%=l(:label_preferences)%> <%= render :partial => 'users/preferences' %> <%= call_hook(:view_users_form_preferences, :user => @user, :form => f) %>
<%= javascript_tag do %> $(document).ready(function(){ $('#user_generate_password').change(function(){ var passwd = $('#user_password, #user_password_confirmation'); if ($(this).is(':checked')){ passwd.val('').attr('disabled', true); }else{ passwd.removeAttr('disabled'); } }).trigger('change'); }); <% end %>