diff options
Diffstat (limited to 'app/views/users')
| -rw-r--r-- | app/views/users/edit.html.erb | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index a8994701..ea5e7dec 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | <h1><%= @user == current_user ? "My account" : "Edit user “#{@user.login}”" %></h1> | 1 | <h1><%= @user == current_user ? t(".my_account") : t(".edit_user", :login => @user.login) %></h1> |
| 2 | 2 | ||
| 3 | <% if @user.errors.any? %> | 3 | <% if @user.errors.any? %> |
| 4 | <div class="error_messages"> | 4 | <div class="error_messages"> |
| @@ -9,61 +9,60 @@ | |||
| 9 | <div id="admin_layout"> | 9 | <div id="admin_layout"> |
| 10 | <%= form_for @user do |f| %> | 10 | <%= form_for @user do |f| %> |
| 11 | <div id="content"> | 11 | <div id="content"> |
| 12 | <div class="layout_row_label">Login</div> | 12 | <div class="layout_row_label"><%= t(".login") %></div> |
| 13 | <div class="layout_row_content"><%= f.text_field :login, :autocomplete => "username" %></div> | 13 | <div class="layout_row_content"><%= f.text_field :login, :autocomplete => "username" %></div> |
| 14 | 14 | ||
| 15 | <div class="layout_row_label">E-Mail</div> | 15 | <div class="layout_row_label"><%= t(".email") %></div> |
| 16 | <div class="layout_row_content"><%= f.text_field :email %></div> | 16 | <div class="layout_row_content"><%= f.text_field :email %></div> |
| 17 | 17 | ||
| 18 | <div class="layout_row_label">Password</div> | 18 | <div class="layout_row_label"><%= t(".password") %></div> |
| 19 | <div class="layout_row_content"><%= f.password_field :password, :autocomplete => "new-password" %></div> | 19 | <div class="layout_row_content"><%= f.password_field :password, :autocomplete => "new-password" %></div> |
| 20 | 20 | ||
| 21 | <div class="layout_row_label">Confirm</div> | 21 | <div class="layout_row_label"><%= t(".confirm") %></div> |
| 22 | <div class="layout_row_content"><%= f.password_field :password_confirmation, :autocomplete => "new-password" %></div> | 22 | <div class="layout_row_content"><%= f.password_field :password_confirmation, :autocomplete => "new-password" %></div> |
| 23 | 23 | ||
| 24 | <% if current_user.admin? %> | 24 | <% if current_user.admin? %> |
| 25 | <div class="layout_row_label">Admin?</div> | 25 | <div class="layout_row_label"><%= t(".admin") %></div> |
| 26 | <div class="layout_row_content"><%= f.check_box :admin %></div> | 26 | <div class="layout_row_content"><%= f.check_box :admin %></div> |
| 27 | <% end %> | 27 | <% end %> |
| 28 | 28 | ||
| 29 | <div class="layout_row_label"></div> | 29 | <div class="layout_row_label"></div> |
| 30 | <div class="layout_row_content"><%= f.submit "Update" %></div> | 30 | <div class="layout_row_content"><%= submit_tag t(".update") %></div> |
| 31 | <% end %> | 31 | <% end %> |
| 32 | </div> | 32 | </div> |
| 33 | 33 | ||
| 34 | <% if @user == current_user %> | 34 | <% if @user == current_user %> |
| 35 | <div class="layout_row_label">Second factor</div> | 35 | <div class="layout_row_label"><%= t(".second_factor") %></div> |
| 36 | <div class="layout_row_content"> | 36 | <div class="layout_row_content"> |
| 37 | <% if current_user.otp_enrolled? %> | 37 | <% if current_user.otp_enrolled? %> |
| 38 | <p>Enabled.</p> | 38 | <p><%= t(".enabled") %></p> |
| 39 | <%= form_tag otp_enrollment_path, :method => :delete, :class => "otp_form" do %> | 39 | <%= form_tag otp_enrollment_path, :method => :delete, :class => "otp_form" do %> |
| 40 | <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> | 40 | <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> |
| 41 | <%= password_field_tag :current_password, nil, :placeholder => "Current password", :autocomplete => "current-password" %> | 41 | <%= password_field_tag :current_password, nil, :placeholder => t(".current_password"), :autocomplete => "current-password" %> |
| 42 | <%= text_field_tag :code, nil, :placeholder => "Current code", | 42 | <%= text_field_tag :code, nil, :placeholder => t(".current_code"), |
| 43 | :autocomplete => "one-time-code", :inputmode => "numeric" %> | 43 | :autocomplete => "one-time-code", :inputmode => "numeric" %> |
| 44 | <%= button_tag :type => "submit", :class => "action_button" do %> | 44 | <%= button_tag :type => "submit", :class => "action_button" do %> |
| 45 | <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> Disable second factor | 45 | <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> <%= t(".disable_second_factor") %> |
| 46 | <% end %> | 46 | <% end %> |
| 47 | <% end %> | 47 | <% end %> |
| 48 | <% else %> | 48 | <% else %> |
| 49 | <p>Not enrolled.</p> | 49 | <p><%= t(".not_enrolled") %></p> |
| 50 | <%= form_tag otp_enrollment_path, :method => :post, :class => "otp_form" do %> | 50 | <%= form_tag otp_enrollment_path, :method => :post, :class => "otp_form" do %> |
| 51 | <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> | 51 | <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> |
| 52 | <%= password_field_tag :current_password, nil, :placeholder => "Current password", :autocomplete => "current-password"%> | 52 | <%= password_field_tag :current_password, nil, :placeholder => t(".current_password"), :autocomplete => "current-password"%> |
| 53 | <%= button_tag :type => "submit", :class => "action_button" do %> | 53 | <%= button_tag :type => "submit", :class => "action_button" do %> |
| 54 | <%= icon("shield-lock", library: "tabler", "aria-hidden": true) %> Enable second factor | 54 | <%= icon("shield-lock", library: "tabler", "aria-hidden": true) %> <%= t(".enable_second_factor") %> |
| 55 | <% end %> | 55 | <% end %> |
| 56 | <% end %> | 56 | <% end %> |
| 57 | <% end %> | 57 | <% end %> |
| 58 | </div> | 58 | </div> |
| 59 | <% elsif current_user.admin? && @user.otp_enrolled? %> | 59 | <% elsif current_user.admin? && @user.otp_enrolled? %> |
| 60 | <div class="layout_row_label">Second factor</div> | 60 | <div class="layout_row_label"><%= t(".second_factor") %></div> |
| 61 | <div class="layout_row_content"> | 61 | <div class="layout_row_content"> |
| 62 | Enabled. | 62 | <%= t(".enabled") %> |
| 63 | <%= button_to "Reset second factor", reset_otp_user_path(@user), :method => :put, | 63 | <%= button_to t(".reset_second_factor"), reset_otp_user_path(@user), :method => :put, |
| 64 | :form_class => "button_to destructive", | 64 | :form_class => "button_to destructive", |
| 65 | :form => { :data => { :confirm => | 65 | :form => { :data => { :confirm => t(".reset_confirm", :login => @user.login) } } %> |
| 66 | "Reset #{@user.login}'s second factor? They will log in with password only afterwards." } } %> | ||
| 67 | </div> | 66 | </div> |
| 68 | <% end %> | 67 | <% end %> |
| 69 | </div> | 68 | </div> |
