diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-24 17:20:22 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-24 17:20:22 +0200 |
| commit | 5f26394947d1150e2656bb22c5858ae5edcdcac7 (patch) | |
| tree | 2aca70e25cfc9809cde0efdfad52854cdc7381e8 /app/views | |
| parent | dcb576618b868b888a5b1b31e35491f300ce4050 (diff) | |
Polish the OTP flows: autocomplete tokens, button dialect, QR sizing, my-account link
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/admin/index.html.erb | 3 | ||||
| -rw-r--r-- | app/views/otp_challenges/new.html.erb | 2 | ||||
| -rw-r--r-- | app/views/otp_enrollments/show.html.erb | 17 | ||||
| -rw-r--r-- | app/views/sessions/new.html.erb | 4 | ||||
| -rw-r--r-- | app/views/users/edit.html.erb | 26 |
5 files changed, 32 insertions, 20 deletions
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index 319530db..4d67dd77 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb | |||
| @@ -53,6 +53,9 @@ | |||
| 53 | <div id="dashboard_housekeeping"> | 53 | <div id="dashboard_housekeeping"> |
| 54 | <h3>Housekeeping</h3> | 54 | <h3>Housekeeping</h3> |
| 55 | <div class="button_row"> | 55 | <div class="button_row"> |
| 56 | <%= link_to edit_user_path(current_user), class: "action_button" do %> | ||
| 57 | <%= icon("user-cog", library: "tabler", "aria-hidden": true) %> My account | ||
| 58 | <% end %> | ||
| 56 | <%= link_to nodes_path, class: "action_button" do %> | 59 | <%= link_to nodes_path, class: "action_button" do %> |
| 57 | <%= icon("list", library: "tabler", "aria-hidden": true) %> Nodes | 60 | <%= icon("list", library: "tabler", "aria-hidden": true) %> Nodes |
| 58 | <% end %> | 61 | <% end %> |
diff --git a/app/views/otp_challenges/new.html.erb b/app/views/otp_challenges/new.html.erb index a9c7a15c..b0d204fb 100644 --- a/app/views/otp_challenges/new.html.erb +++ b/app/views/otp_challenges/new.html.erb | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | <div id="page_editor"> | 3 | <div id="page_editor"> |
| 4 | <div class="node_description">Code</div> | 4 | <div class="node_description">Code</div> |
| 5 | <div class="node_content"> | 5 | <div class="node_content"> |
| 6 | <%= form_tag otp_challenge_path, :method => :post do %> | 6 | <%= form_tag otp_challenge_path, :method => :post, :class => "otp_form" do %> |
| 7 | <%= text_field_tag :code, nil, :autofocus => true, | 7 | <%= text_field_tag :code, nil, :autofocus => true, |
| 8 | :autocomplete => "one-time-code", :inputmode => "numeric" %> | 8 | :autocomplete => "one-time-code", :inputmode => "numeric" %> |
| 9 | <%= submit_tag "Log in" %> | 9 | <%= submit_tag "Log in" %> |
diff --git a/app/views/otp_enrollments/show.html.erb b/app/views/otp_enrollments/show.html.erb index 9dfa3422..90c42b59 100644 --- a/app/views/otp_enrollments/show.html.erb +++ b/app/views/otp_enrollments/show.html.erb | |||
| @@ -3,19 +3,22 @@ | |||
| 3 | <div id="page_editor"> | 3 | <div id="page_editor"> |
| 4 | <div class="node_description">Scan</div> | 4 | <div class="node_description">Scan</div> |
| 5 | <div class="node_content"> | 5 | <div class="node_content"> |
| 6 | <%= raw RQRCode::QRCode.new(current_user.pending_otp_provisioning_uri) | 6 | <div class="otp_qr"> |
| 7 | .as_svg(:module_size => 4, :viewbox => true, | 7 | <%= raw RQRCode::QRCode.new(current_user.pending_otp_provisioning_uri) |
| 8 | :color => "000", :fill => "fff") %> | 8 | .as_svg(:module_size => 4, :viewbox => true, |
| 9 | <span class="field_hint">Or enter the secret manually: | 9 | :color => "000", :fill => "fff") %> |
| 10 | <code><%= current_user.otp_pending_secret %></code></span> | 10 | </div> |
| 11 | <span class="field_hint">Or enter the secret manually: <code><%= current_user.otp_pending_secret %></code></span> | ||
| 11 | </div> | 12 | </div> |
| 12 | 13 | ||
| 13 | <div class="node_description">Confirm</div> | 14 | <div class="node_description">Confirm</div> |
| 14 | <div class="node_content"> | 15 | <div class="node_content"> |
| 15 | <%= form_tag otp_enrollment_path, :method => :put do %> | 16 | <%= form_tag otp_enrollment_path, :method => :put, :class => "otp_form" do %> |
| 16 | <%= text_field_tag :code, nil, :autofocus => true, | 17 | <%= text_field_tag :code, nil, :autofocus => true, |
| 17 | :autocomplete => "one-time-code", :inputmode => "numeric" %> | 18 | :autocomplete => "one-time-code", :inputmode => "numeric" %> |
| 18 | <%= submit_tag "Confirm" %> | 19 | <%= button_tag :type => "submit", :class => "action_button" do %> |
| 20 | <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> Confirm | ||
| 21 | <% end %> | ||
| 19 | <% end %> | 22 | <% end %> |
| 20 | <span class="field_hint">Enter the six-digit code your app shows | 23 | <span class="field_hint">Enter the six-digit code your app shows |
| 21 | for “<%= OTP_ISSUER %>”.</span> | 24 | for “<%= OTP_ISSUER %>”.</span> |
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 23952b73..b23f6a0c 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb | |||
| @@ -5,10 +5,10 @@ | |||
| 5 | <% end %> | 5 | <% end %> |
| 6 | 6 | ||
| 7 | <div class="node_description">Login</div> | 7 | <div class="node_description">Login</div> |
| 8 | <div class="node_content"><%= text_field_tag 'login', @login %></div> | 8 | <div class="node_content"><%= text_field_tag 'login', @login, :autocomplete => "username" %></div> |
| 9 | 9 | ||
| 10 | <div class="node_description">Password</div> | 10 | <div class="node_description">Password</div> |
| 11 | <div class="node_content"><%= password_field_tag 'password', nil %></div> | 11 | <div class="node_content"><%= password_field_tag 'password', nil, :autocomplete => "current-password" %></div> |
| 12 | 12 | ||
| 13 | <div class="node_content"><%= submit_tag 'log in' %></div> | 13 | <div class="node_content"><%= submit_tag 'log in' %></div> |
| 14 | <% end -%> | 14 | <% end -%> |
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 8d14a058..8adad789 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | <h1>Edit existing user</h1> | 1 | <h1><%= @user == current_user ? "My account" : "Edit user “#{@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"> |
| @@ -10,16 +10,16 @@ | |||
| 10 | <%= form_for @user do |f| %> | 10 | <%= form_for @user do |f| %> |
| 11 | <div id="content"> | 11 | <div id="content"> |
| 12 | <div class="node_description">Login</div> | 12 | <div class="node_description">Login</div> |
| 13 | <div class="node_content"><%= f.text_field :login %></div> | 13 | <div class="node_content"><%= f.text_field :login, :autocomplete => "username" %></div> |
| 14 | 14 | ||
| 15 | <div class="node_description">E-Mail</div> | 15 | <div class="node_description">E-Mail</div> |
| 16 | <div class="node_content"><%= f.text_field :email %></div> | 16 | <div class="node_content"><%= f.text_field :email %></div> |
| 17 | 17 | ||
| 18 | <div class="node_description">Password</div> | 18 | <div class="node_description">Password</div> |
| 19 | <div class="node_content"><%= f.password_field :password %></div> | 19 | <div class="node_content"><%= f.password_field :password, :autocomplete => "new-password" %></div> |
| 20 | 20 | ||
| 21 | <div class="node_description">Confirm</div> | 21 | <div class="node_description">Confirm</div> |
| 22 | <div class="node_content"><%= f.password_field :password_confirmation %></div> | 22 | <div class="node_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="node_description">Admin?</div> | 25 | <div class="node_description">Admin?</div> |
| @@ -36,17 +36,23 @@ | |||
| 36 | <div class="node_content"> | 36 | <div class="node_content"> |
| 37 | <% if current_user.otp_enrolled? %> | 37 | <% if current_user.otp_enrolled? %> |
| 38 | <p>Enabled.</p> | 38 | <p>Enabled.</p> |
| 39 | <%= form_tag otp_enrollment_path, :method => :delete do %> | 39 | <%= form_tag otp_enrollment_path, :method => :delete, :class => "otp_form" do %> |
| 40 | <%= password_field_tag :current_password, nil, :placeholder => "Current password" %> | 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 | <%= text_field_tag :code, nil, :placeholder => "Current code", | 42 | <%= text_field_tag :code, nil, :placeholder => "Current code", |
| 42 | :autocomplete => "one-time-code", :inputmode => "numeric" %> | 43 | :autocomplete => "one-time-code", :inputmode => "numeric" %> |
| 43 | <%= submit_tag "Disable second factor" %> | 44 | <%= button_tag :type => "submit", :class => "action_button" do %> |
| 45 | <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> Disable second factor | ||
| 46 | <% end %> | ||
| 44 | <% end %> | 47 | <% end %> |
| 45 | <% else %> | 48 | <% else %> |
| 46 | <p>Not enrolled.</p> | 49 | <p>Not enrolled.</p> |
| 47 | <%= form_tag otp_enrollment_path, :method => :post do %> | 50 | <%= form_tag otp_enrollment_path, :method => :post, :class => "otp_form" do %> |
| 48 | <%= password_field_tag :current_password, nil, :placeholder => "Current password" %> | 51 | <%= text_field_tag :login, current_user.login, :autocomplete => "username", :readonly => true, :tabindex => -1, :class => "visually_hidden" %> |
| 49 | <%= submit_tag "Enable second factor" %> | 52 | <%= password_field_tag :current_password, nil, :placeholder => "Current password", :autocomplete => "current-password"%> |
| 53 | <%= button_tag :type => "submit", :class => "action_button" do %> | ||
| 54 | <%= icon("shield-lock", library: "tabler", "aria-hidden": true) %> Enable second factor | ||
| 55 | <% end %> | ||
| 50 | <% end %> | 56 | <% end %> |
| 51 | <% end %> | 57 | <% end %> |
| 52 | </div> | 58 | </div> |
