diff options
| -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 | ||||
| -rw-r--r-- | config/initializers/filter_parameter_logging.rb | 2 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 30 |
7 files changed, 63 insertions, 21 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> |
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c0b717f7..bf72b0f3 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb | |||
| @@ -4,5 +4,5 @@ | |||
| 4 | # Use this to limit dissemination of sensitive information. | 4 | # Use this to limit dissemination of sensitive information. |
| 5 | # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. | 5 | # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. |
| 6 | Rails.application.config.filter_parameters += [ | 6 | Rails.application.config.filter_parameters += [ |
| 7 | :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc | 7 | :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc, :code, :current_password |
| 8 | ] | 8 | ] |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index fe702b09..23a9a581 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -1619,3 +1619,33 @@ div#draft_list table td.actions a { | |||
| 1619 | max-height: 20em; | 1619 | max-height: 20em; |
| 1620 | overflow-y: auto; | 1620 | overflow-y: auto; |
| 1621 | } | 1621 | } |
| 1622 | |||
| 1623 | /* ============================================================ | ||
| 1624 | User section | ||
| 1625 | ============================================================ */ | ||
| 1626 | |||
| 1627 | form.otp_form { | ||
| 1628 | margin-top: 0.75rem; | ||
| 1629 | } | ||
| 1630 | |||
| 1631 | form.otp_form input[type=password], | ||
| 1632 | form.otp_form input[type=text] { | ||
| 1633 | display: block; | ||
| 1634 | margin-bottom: 0.5rem; | ||
| 1635 | } | ||
| 1636 | |||
| 1637 | .visually_hidden { | ||
| 1638 | position: absolute; | ||
| 1639 | width: 1px; | ||
| 1640 | height: 1px; | ||
| 1641 | overflow: hidden; | ||
| 1642 | clip-path: inset(50%); | ||
| 1643 | white-space: nowrap; | ||
| 1644 | } | ||
| 1645 | |||
| 1646 | .otp_qr svg { | ||
| 1647 | width: 220px; | ||
| 1648 | height: auto; | ||
| 1649 | display: block; | ||
| 1650 | margin-bottom: 0.5rem; | ||
| 1651 | } | ||
