From 90207029de7474082310d0725801d60f7145fa98 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 24 Jul 2026 22:08:05 +0200 Subject: Extract admin strings to i18n: sessions, otp, users/edit --- app/views/otp_challenges/new.html.erb | 8 +++---- app/views/otp_enrollments/show.html.erb | 11 +++++----- app/views/sessions/new.html.erb | 6 ++--- app/views/users/edit.html.erb | 39 ++++++++++++++++----------------- 4 files changed, 31 insertions(+), 33 deletions(-) (limited to 'app/views') diff --git a/app/views/otp_challenges/new.html.erb b/app/views/otp_challenges/new.html.erb index d6e18c85..677244c7 100644 --- a/app/views/otp_challenges/new.html.erb +++ b/app/views/otp_challenges/new.html.erb @@ -1,13 +1,13 @@ -

Second factor

+

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

-
Code
+
<%= t(".code") %>
<%= form_tag otp_challenge_path, :method => :post, :class => "otp_form" do %> <%= text_field_tag :code, nil, :autofocus => true, :autocomplete => "one-time-code", :inputmode => "numeric" %> - <%= submit_tag "Log in" %> + <%= submit_tag t(".log_in") %> <% end %> - Enter the six-digit code from your authenticator app. + <%= t(".hint") %>
diff --git a/app/views/otp_enrollments/show.html.erb b/app/views/otp_enrollments/show.html.erb index 12067ae3..e18d7fd1 100644 --- a/app/views/otp_enrollments/show.html.erb +++ b/app/views/otp_enrollments/show.html.erb @@ -1,14 +1,14 @@ -

Enable second factor

+

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

-
Scan
+
<%= t(".scan") %>
<%= raw RQRCode::QRCode.new(current_user.pending_otp_provisioning_uri) .as_svg(:module_size => 4, :viewbox => true, :color => "000", :fill => "fff") %>
- Or enter the secret manually: <%= current_user.otp_pending_secret %> + <%= t(".manual_hint") %> <%= current_user.otp_pending_secret %>
Confirm
@@ -17,10 +17,9 @@ <%= text_field_tag :code, nil, :autofocus => true, :autocomplete => "one-time-code", :inputmode => "numeric" %> <%= button_tag :type => "submit", :class => "action_button" do %> - <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> Confirm + <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> <%= t(".confirm") %> <% end %> <% end %> - Enter the six-digit code your app shows - for “<%= OTP_ISSUER %>”. + <%= t(".app_hint", :issuer => OTP_ISSUER) %>
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 1c2c2368..3f115d58 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -4,12 +4,12 @@
<%= flash[:error] %>
<% end %> -
Login
+
<%= t(".login") %>
<%= text_field_tag 'login', @login, :autocomplete => "username" %>
-
Password
+
<%= t(".password") %>
<%= password_field_tag 'password', nil, :autocomplete => "current-password" %>
-
<%= submit_tag 'log in' %>
+
<%= submit_tag t(".log_in") %>
<% end -%> 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 @@ -

<%= @user == current_user ? "My account" : "Edit user “#{@user.login}”" %>

+

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

<% if @user.errors.any? %>
@@ -9,61 +9,60 @@
<%= form_for @user do |f| %>
-
Login
+
<%= t(".login") %>
<%= f.text_field :login, :autocomplete => "username" %>
-
E-Mail
+
<%= t(".email") %>
<%= f.text_field :email %>
-
Password
+
<%= t(".password") %>
<%= f.password_field :password, :autocomplete => "new-password" %>
-
Confirm
+
<%= t(".confirm") %>
<%= f.password_field :password_confirmation, :autocomplete => "new-password" %>
<% if current_user.admin? %> -
Admin?
+
<%= t(".admin") %>
<%= f.check_box :admin %>
<% end %>
-
<%= f.submit "Update" %>
+
<%= submit_tag t(".update") %>
<% end %>
<% if @user == current_user %> -
Second factor
+
<%= t(".second_factor") %>
<% if current_user.otp_enrolled? %> -

Enabled.

+

<%= 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 => "Current password", :autocomplete => "current-password" %> - <%= text_field_tag :code, nil, :placeholder => "Current code", + <%= 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) %> Disable second factor + <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> <%= t(".disable_second_factor") %> <% end %> <% end %> <% else %> -

Not enrolled.

+

<%= 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 => "Current password", :autocomplete => "current-password"%> + <%= 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) %> Enable second factor + <%= icon("shield-lock", library: "tabler", "aria-hidden": true) %> <%= t(".enable_second_factor") %> <% end %> <% end %> <% end %>
<% elsif current_user.admin? && @user.otp_enrolled? %> -
Second factor
+
<%= t(".second_factor") %>
- Enabled. - <%= button_to "Reset second factor", reset_otp_user_path(@user), :method => :put, + <%= t(".enabled") %> + <%= button_to t(".reset_second_factor"), reset_otp_user_path(@user), :method => :put, :form_class => "button_to destructive", - :form => { :data => { :confirm => - "Reset #{@user.login}'s second factor? They will log in with password only afterwards." } } %> + :form => { :data => { :confirm => t(".reset_confirm", :login => @user.login) } } %>
<% end %>
-- cgit v1.3