From 445362ed2f8591d54a3c34cb3c5a69049aefa8c6 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 15 Aug 2026 16:28:21 +0200 Subject: Style totp input fields so that they work better on mobile --- app/views/elevations/new.html.erb | 3 ++- app/views/otp_challenges/new.html.erb | 9 ++++++--- app/views/otp_enrollments/show.html.erb | 5 +++-- app/views/users/edit.html.erb | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/views/elevations/new.html.erb b/app/views/elevations/new.html.erb index 8dd64e78..8e1b59c2 100644 --- a/app/views/elevations/new.html.erb +++ b/app/views/elevations/new.html.erb @@ -10,7 +10,8 @@
<%= t(".code") %>
<%= text_field_tag :code, nil, :autocomplete => "one-time-code", - :inputmode => "numeric", :autofocus => true %> + :inputmode => "numeric", :autofocus => true, :maxlength => 6, + :pattern => "[0-9]{6}", :class => "otp_code" %>
diff --git a/app/views/otp_challenges/new.html.erb b/app/views/otp_challenges/new.html.erb index 8247b262..ff7df222 100644 --- a/app/views/otp_challenges/new.html.erb +++ b/app/views/otp_challenges/new.html.erb @@ -6,10 +6,13 @@
<%= 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 t(".log_in") %> + :autocomplete => "one-time-code", :inputmode => "numeric", + :maxlength => 6, :pattern => "[0-9]{6}", :class => "otp_code" %> + <%= t(".hint") %> + <%= button_tag :type => "submit", :class => "action_button" do %> + <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> <%= t(".log_in") %> + <% end %> <% end %> - <%= t(".hint") %>
diff --git a/app/views/otp_enrollments/show.html.erb b/app/views/otp_enrollments/show.html.erb index 16addb5b..a7604dd2 100644 --- a/app/views/otp_enrollments/show.html.erb +++ b/app/views/otp_enrollments/show.html.erb @@ -18,12 +18,13 @@
<%= form_tag otp_enrollment_path, :method => :put, :class => "otp_form" do %> <%= text_field_tag :code, nil, :autofocus => true, - :autocomplete => "one-time-code", :inputmode => "numeric" %> + :autocomplete => "one-time-code", :inputmode => "numeric", + :maxlength => 6, :pattern => "[0-9]{6}", :class => "otp_code" %> + <%= t(".app_hint", :issuer => OTP_ISSUER) %> <%= button_tag :type => "submit", :class => "action_button" do %> <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> <%= t(".confirm") %> <% end %> <% end %> - <%= t(".app_hint", :issuer => OTP_ISSUER) %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 2cf5a07c..14e19e39 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -59,8 +59,9 @@

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

<%= form_tag otp_enrollment_path, :method => :delete, :class => "otp_form" do %> <%= 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" %> + <%= text_field_tag :code, nil, :autocomplete => "one-time-code", :inputmode => "numeric", + :maxlength => 6, :pattern => "[0-9]{6}", :class => "otp_code" %> + <%= t(".reset_hint") %> <%= button_tag :type => "submit", :class => "action_button" do %> <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> <%= t(".disable_second_factor") %> <% end %> -- cgit v1.3