<%= @user == current_user ? t(".my_account") : t(".edit_user", :login => @user.login) %>

<% if @user.errors.any? %>
<% end %>
<%= form_for @user do |f| %>
<%= t("users.labels.login") %>
<%= f.text_field :login, :autocomplete => "username" %>
<%= t("users.labels.email") %>
<%= f.text_field :email %>
<%= t("users.labels.password") %>
<%= f.password_field :password, :autocomplete => "new-password" %>
<%= t("users.labels.confirm") %>
<%= f.password_field :password_confirmation, :autocomplete => "new-password" %>
<% if current_user.admin? %>
<%= t("users.labels.admin") %>
<%= f.check_box :admin %>
<% end %>
<%= submit_tag t(".update") %>
<% end %>
<% if @user == current_user %>
<%= t(".second_factor") %>
<% if current_user.otp_enrolled? %>

<%= t(".enabled") %>

<%= form_tag otp_enrollment_path, :method => :delete, :class => "otp_form" do %> <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> <%= password_field_tag :current_password, nil, :placeholder => t(".current_password"), :autocomplete => "current-password" %> <%= text_field_tag :code, nil, :placeholder => t(".current_code"), :autocomplete => "one-time-code", :inputmode => "numeric" %> <%= button_tag :type => "submit", :class => "action_button" do %> <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> <%= t(".disable_second_factor") %> <% end %> <% end %> <% else %>

<%= t(".not_enrolled") %>

<%= form_tag otp_enrollment_path, :method => :post, :class => "otp_form" do %> <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> <%= password_field_tag :current_password, nil, :placeholder => t(".current_password"), :autocomplete => "current-password"%> <%= button_tag :type => "submit", :class => "action_button" do %> <%= icon("shield-lock", library: "tabler", "aria-hidden": true) %> <%= t(".enable_second_factor") %> <% end %> <% end %> <% end %>
<% elsif current_user.admin? && @user.otp_enrolled? %>
<%= t(".second_factor") %>
<%= t(".enabled") %> <%= button_to t(".reset_second_factor"), reset_otp_user_path(@user), :method => :put, :form_class => "button_to destructive", :form => { :data => { :confirm => t(".reset_confirm", :login => @user.login) } } %>
<% end %>