diff --git a/app/assets/stylesheets/components/links.css b/app/assets/stylesheets/components/links.css index c46f68b..92c9c75 100644 --- a/app/assets/stylesheets/components/links.css +++ b/app/assets/stylesheets/components/links.css @@ -5,10 +5,4 @@ &:visited { @apply text-indigo-600; } &:active { @apply text-red-600; } } - - .devise-links { - a { - @apply ks-text-link; - } - } } diff --git a/app/components/form_elements/toggle_component.html.erb b/app/components/form_elements/toggle_component.html.erb index 41a6708..8d6faf9 100644 --- a/app/components/form_elements/toggle_component.html.erb +++ b/app/components/form_elements/toggle_component.html.erb @@ -1,6 +1,6 @@ <%= button_tag type: "button", name: "toggle", data: @data, role: "switch", aria: { checked: @enabled.to_s }, - disabled: !@input_enabled, + tabindex: @tabindex, disabled: !@input_enabled, class: "#{ @enabled ? 'bg-blue-600' : 'bg-gray-200' } #{ @class_names.present? ? @class_names : '' } relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer diff --git a/app/components/form_elements/toggle_component.rb b/app/components/form_elements/toggle_component.rb index d2f5eae..8bb7181 100644 --- a/app/components/form_elements/toggle_component.rb +++ b/app/components/form_elements/toggle_component.rb @@ -2,11 +2,12 @@ module FormElements class ToggleComponent < ViewComponent::Base - def initialize(enabled:, input_enabled: true, data: nil, class_names: nil) + def initialize(enabled:, input_enabled: true, data: nil, class_names: nil, tabindex: nil) @enabled = !!enabled @input_enabled = input_enabled @data = data @class_names = class_names + @tabindex = tabindex end end end diff --git a/app/javascript/controllers/notification_controller.js b/app/javascript/controllers/notification_controller.js index e0291ce..9e09dc4 100644 --- a/app/javascript/controllers/notification_controller.js +++ b/app/javascript/controllers/notification_controller.js @@ -4,6 +4,10 @@ export default class extends Controller { static targets = ["buttons", "countdown"] connect() { + // Devise timeoutable ends up adding a second flash message without content + // TODO investigate bug + if (this.element.textContent.trim() == "true") return; + const timeoutSeconds = parseInt(this.data.get("timeout")); setTimeout(() => { diff --git a/app/models/user.rb b/app/models/user.rb index ebe76cb..d8ebee8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -38,7 +38,9 @@ class User < ApplicationRecord devise :ldap_authenticatable, :confirmable, :recoverable, - :validatable + :validatable, + :timeoutable, + :rememberable def ldap_before_save self.email = Devise::LDAP::Adapter.get_ldap_param(self.cn, "mail").first diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 687d90a..f7c0a70 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -7,19 +7,43 @@ <%= f.label :cn, 'User', class: 'block mb-2 font-bold' %>
<%= f.text_field :cn, autofocus: true, autocomplete: "username", - required: true, class: "relative grow"%> + required: true, class: "relative grow", tabindex: "1" %> @ kosmos.org
-+
<%= f.label :password, class: 'block mb-2 font-bold' %> <%= f.password_field :password, autocomplete: "current-password", - required: true, class: "w-full"%> + required: true, class: "w-full", tabindex: "2" %>
-- <%= f.submit "Log in", class: 'btn-md btn-blue w-full' %> + + <%= tag.div class: "flex items-center mb-8 gap-x-3", data: { + controller: "settings--toggle", + :'settings--toggle-switch-enabled-value' => "false" + } do %> +
+ <%= link_to "Forgot your password?", new_password_path(resource_name),
+ class: "text-gray-500 underline" %>
+
+ <%= f.submit "Log in", class: 'btn-md btn-blue w-full', tabindex: "4" %>
<% end %> - - <%= render "devise/shared/links" %> <% end %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index b1d1ccd..2499950 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -1,25 +1,29 @@
- <%= link_to "Log in", new_session_path(resource_name) %>
+
+ <%= link_to "Log in", new_session_path(resource_name), + class: "text-gray-500 underline" %>
<% end %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> -
- <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+
+ <%= link_to "Forgot your password?", new_password_path(resource_name), + class: "text-gray-500 underline" %>
<% end %> - <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> -
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+ <%- if devise_mapping.confirmable? && !controller_name.match(/^(confirmations|sessions)$/) %>
+
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), + class: "text-gray-500 underline" %>
<% end %> <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> -
- <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name), + class: "text-gray-500 underline" %>
<% end %>