lesli_shield 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/app/assets/stylesheets/lesli_shield/application.css +1222 -1
  4. data/app/assets/stylesheets/lesli_shield/confirmations.css +917 -18
  5. data/app/assets/stylesheets/lesli_shield/confirmations.tailwind.css +918 -0
  6. data/app/assets/stylesheets/lesli_shield/invitations.css +1008 -0
  7. data/app/assets/stylesheets/lesli_shield/passwords.css +872 -18
  8. data/app/assets/stylesheets/lesli_shield/passwords.tailwind.css +873 -0
  9. data/app/assets/stylesheets/lesli_shield/registrations.css +904 -832
  10. data/app/assets/stylesheets/lesli_shield/registrations.tailwind.css +908 -0
  11. data/app/assets/stylesheets/lesli_shield/sessions.css +984 -32
  12. data/app/assets/stylesheets/lesli_shield/sessions.tailwind.css +983 -1
  13. data/app/controllers/lesli_shield/invites_controller.rb +100 -49
  14. data/app/controllers/lesli_shield/profile/passwords_controller.rb +119 -0
  15. data/app/controllers/lesli_shield/profiles_controller.rb +69 -0
  16. data/app/controllers/lesli_shield/role/actions_controller.rb +134 -38
  17. data/app/controllers/lesli_shield/roles_controller.rb +114 -141
  18. data/app/controllers/lesli_shield/sessions_controller.rb +1 -2
  19. data/app/controllers/lesli_shield/users_controller.rb +11 -4
  20. data/app/controllers/users/confirmations_controller.rb +162 -49
  21. data/app/controllers/users/invitations_controller.rb +101 -0
  22. data/app/controllers/users/passwords_controller.rb +211 -28
  23. data/app/controllers/users/registrations_controller.rb +108 -83
  24. data/app/controllers/users/sessions_controller.rb +124 -84
  25. data/app/interfaces/lesli_shield/authorization_interface.rb +2 -2
  26. data/app/jobs/lesli_shield/invitation_delivery_job.rb +123 -0
  27. data/app/mailers/lesli_shield/devise_mailer.rb +73 -17
  28. data/app/mailers/lesli_shield/invitation_mailer.rb +58 -0
  29. data/app/models/concerns/lesli_shield/role_management.rb +70 -0
  30. data/app/models/concerns/lesli_shield/user_authentication.rb +54 -0
  31. data/app/models/concerns/lesli_shield/user_security.rb +22 -19
  32. data/app/models/lesli_shield/account.rb +4 -1
  33. data/app/models/lesli_shield/invite.rb +183 -12
  34. data/app/models/lesli_shield/user/role.rb +1 -1
  35. data/app/models/lesli_shield/user.rb +5 -2
  36. data/app/services/lesli_shield/invitation_audit.rb +34 -0
  37. data/app/services/lesli_shield/invitation_email_policy.rb +64 -0
  38. data/app/services/lesli_shield/invitation_service.rb +405 -0
  39. data/app/services/lesli_shield/invite_service.rb +34 -5
  40. data/app/services/lesli_shield/profile/password_service.rb +47 -0
  41. data/app/services/lesli_shield/profile_service.rb +25 -0
  42. data/app/services/lesli_shield/role_action_service.rb +37 -92
  43. data/app/services/lesli_shield/role_audit.rb +42 -0
  44. data/app/services/lesli_shield/role_permission_service.rb +347 -0
  45. data/app/services/lesli_shield/role_privilege_deployment_service.rb +79 -0
  46. data/app/services/lesli_shield/role_privilege_service.rb +69 -105
  47. data/app/services/lesli_shield/role_service.rb +431 -0
  48. data/app/services/lesli_shield/user_registration_service.rb +41 -74
  49. data/app/services/lesli_shield/user_session_service.rb +1 -1
  50. data/app/services/lesli_shield/user_validator_service.rb +37 -39
  51. data/app/views/devise/confirmations/new.html.erb +58 -12
  52. data/app/views/devise/confirmations/show.html.erb +27 -60
  53. data/app/views/devise/passwords/edit.html.erb +59 -25
  54. data/app/views/devise/passwords/new.html.erb +61 -26
  55. data/app/views/devise/registrations/new.html.erb +83 -56
  56. data/app/views/devise/sessions/new.html.erb +58 -41
  57. data/app/views/devise/shared/_application-devise-simple.erb +18 -19
  58. data/app/views/devise/shared/_demo.html.erb +8 -6
  59. data/app/views/devise/shared/_error_messages.html.erb +45 -10
  60. data/app/views/devise/shared/_links.html.erb +10 -20
  61. data/app/views/lesli_shield/invites/_form.html.erb +64 -7
  62. data/app/views/lesli_shield/invites/_invite.html.erb +55 -2
  63. data/app/views/lesli_shield/invites/_invite_actions.html.erb +34 -0
  64. data/app/views/lesli_shield/invites/_status_badge.html.erb +13 -0
  65. data/app/views/lesli_shield/invites/index.html.erb +119 -62
  66. data/app/views/lesli_shield/invites/new.html.erb +11 -36
  67. data/app/views/lesli_shield/invites/show.html.erb +13 -52
  68. data/app/views/lesli_shield/profiles/_information-form.html.erb +11 -0
  69. data/app/views/lesli_shield/profiles/_password-form.html.erb +68 -0
  70. data/app/views/lesli_shield/profiles/show.html.erb +26 -0
  71. data/app/views/lesli_shield/role/actions/_custom_actions.html.erb +24 -0
  72. data/app/views/lesli_shield/role/actions/_deployment_status.html.erb +14 -0
  73. data/app/views/lesli_shield/role/actions/_matrix.html.erb +69 -0
  74. data/app/views/lesli_shield/role/actions/_permissions.html.erb +95 -0
  75. data/app/views/lesli_shield/role/actions/_toggle.html.erb +34 -0
  76. data/app/views/lesli_shield/role/actions/index.html.erb +14 -10
  77. data/app/views/lesli_shield/roles/_deployment_badge.html.erb +15 -0
  78. data/app/views/lesli_shield/roles/_empty_state.html.erb +20 -0
  79. data/app/views/lesli_shield/roles/_field_errors.html.erb +5 -0
  80. data/app/views/lesli_shield/roles/_filters.html.erb +66 -0
  81. data/app/views/lesli_shield/roles/_form.html.erb +149 -18
  82. data/app/views/lesli_shield/roles/_management_menu.html.erb +37 -0
  83. data/app/views/lesli_shield/roles/_pagination.html.erb +43 -0
  84. data/app/views/lesli_shield/roles/_role_list.html.erb +116 -0
  85. data/app/views/lesli_shield/roles/_status_badge.html.erb +11 -0
  86. data/app/views/lesli_shield/roles/_type_badge.html.erb +9 -0
  87. data/app/views/lesli_shield/roles/index.html.erb +15 -38
  88. data/app/views/lesli_shield/roles/new.html.erb +11 -0
  89. data/app/views/lesli_shield/roles/show.html.erb +79 -7
  90. data/app/views/lesli_shield/users/_information-form.html.erb +15 -1
  91. data/app/views/users/invitations/show.html.erb +142 -0
  92. data/app/views/users/invitations/unavailable.html.erb +19 -0
  93. data/config/initializers/devise.rb +52 -328
  94. data/config/locales/devise.en.yml +8 -0
  95. data/config/locales/devise.es.yml +8 -0
  96. data/config/locales/translations.en.yml +314 -16
  97. data/config/locales/translations.es.yml +314 -16
  98. data/config/routes.rb +14 -3
  99. data/db/migrate/v1/0801120110_create_lesli_shield_invites.rb +40 -6
  100. data/lib/lesli_shield/engine.rb +42 -4
  101. data/lib/lesli_shield/router.rb +62 -18
  102. data/lib/lesli_shield/version.rb +2 -2
  103. data/lib/tasks/lesli_shield_tasks.rake +1 -1
  104. data/readme.md +17 -3
  105. metadata +63 -8
  106. data/app/assets/config/lesli_shield_manifest.js +0 -48
  107. data/app/assets/stylesheets/lesli_shield/application.tailwind.css +0 -2
  108. data/app/mailers/lesli_shield/invitation.html.erb +0 -23
  109. data/app/views/lesli_shield/invites/edit.html.erb +0 -12
  110. data/app/views/lesli_shield/role/actions/_form.html.erb +0 -75
@@ -33,11 +33,17 @@ Building a better future, one line of code at a time.
33
33
  module LesliShield
34
34
  class UserValidatorService < Lesli::ApplicationLesliService
35
35
 
36
- def validate
36
+ def initialize(user)
37
+ raise ArgumentError, "user is required" unless user
38
+
39
+ super(user)
40
+ end
41
+
42
+ def validate
43
+ account_present?()
37
44
  active?()
38
- confirmed?()
39
- roles_empty?()
40
- active_roles?()
45
+ active_roles?() unless roles_empty?()
46
+ self
41
47
  end
42
48
 
43
49
 
@@ -46,7 +52,7 @@ module LesliShield
46
52
  def password_complexity(password)
47
53
 
48
54
  if password.blank?
49
- failures.push('error_password_cannot_be_blank')
55
+ errors.push('error_password_cannot_be_blank')
50
56
  return self
51
57
  end
52
58
 
@@ -69,10 +75,10 @@ module LesliShield
69
75
  password_settings = []
70
76
 
71
77
  # get password settings from the database
72
- if @resource.account
78
+ if current_user.account
73
79
 
74
80
  # if user is already registered
75
- password_settings = @resource.account.settings.where(password_values.join(" or "))
81
+ password_settings = current_user.account.settings.where(password_values.join(" or "))
76
82
 
77
83
  elseif Account.first
78
84
 
@@ -85,7 +91,7 @@ module LesliShield
85
91
 
86
92
  # exit validations if password complexity is not enabled
87
93
  if settings[:name] == 'password_enforce_complexity' && settings[:value] != "1"
88
- failures = []
94
+ errors.clear
89
95
  break
90
96
  end
91
97
 
@@ -94,7 +100,7 @@ module LesliShield
94
100
 
95
101
  # this regex removes all "normal" letters and numbers leaving special characters
96
102
  if settings[:value].to_i > password.scan(/[^0-9A-Za-z]/).length
97
- failures.push('error_password_special_char_count')
103
+ errors.push('error_password_special_char_count')
98
104
  end
99
105
 
100
106
  end
@@ -103,7 +109,7 @@ module LesliShield
103
109
  if settings[:name] == 'password_lowercase_count'
104
110
 
105
111
  if settings[:value].to_i > password_string_no_special.scan(/[^0-9A-Z]/).length
106
- failures.push('error_password_lowercase_count')
112
+ errors.push('error_password_lowercase_count')
107
113
  end
108
114
 
109
115
  end
@@ -112,7 +118,7 @@ module LesliShield
112
118
  if settings[:name] == 'password_uppercase_count'
113
119
 
114
120
  if settings[:value].to_i > password_string_no_special.scan(/[^0-9a-z]/).length
115
- failures.push('error_password_uppercase_count')
121
+ errors.push('error_password_uppercase_count')
116
122
  end
117
123
 
118
124
  end
@@ -121,7 +127,7 @@ module LesliShield
121
127
  if settings[:name] == 'password_digit_count'
122
128
 
123
129
  if settings[:value].to_i > password_string_no_special.scan(/[^A-Za-z]/).length
124
- failures.push('error_password_digit_count')
130
+ errors.push('error_password_digit_count')
125
131
  end
126
132
 
127
133
  end
@@ -130,7 +136,7 @@ module LesliShield
130
136
  if settings[:name] == 'password_minimum_length'
131
137
 
132
138
  if settings[:value].to_i > password.length
133
- failures.push('error_password_minimum_length')
139
+ errors.push('error_password_minimum_length')
134
140
  end
135
141
 
136
142
  end
@@ -142,47 +148,45 @@ module LesliShield
142
148
  end
143
149
 
144
150
  def valid?
145
- failures.empty?
151
+ errors.empty?
146
152
  end
147
153
 
148
154
  private
149
155
 
150
-
151
- # check if user is able to create a new session
152
- def active?
153
-
154
- unless @resource.active? && @resource.locked_until != nil
155
-
156
- # save a locked log for the requested user
157
- log_failure("user_locked")
156
+ # Devise owns password, confirmation, and failed-attempt locking. This
157
+ # service contains only the additional access rules defined by Shield.
158
+ def account_present?
159
+ unless current_user.account.present?
160
+ log_failure("user_has_no_account")
158
161
 
159
162
  return false
160
-
161
163
  end
162
164
 
163
- return true
165
+ true
164
166
  end
165
167
 
166
- def confirmed?
167
168
 
168
- # check if user is already confirmed
169
- unless @resource.confirmed?
169
+ # check if user is able to create a new session
170
+ def active?
171
+ temporarily_locked = current_user.locked_until.present? &&
172
+ current_user.locked_until > Time.current
170
173
 
171
- # save a invalid credentials log for the requested user
172
- log_failure("email_not_confirmed")
174
+ unless current_user.active? && !temporarily_locked
175
+
176
+ # save a locked log for the requested user
177
+ log_failure("user_locked")
173
178
 
174
179
  return false
175
180
 
176
181
  end
177
182
 
178
183
  return true
179
-
180
184
  end
181
185
 
182
186
  def roles_empty?
183
187
 
184
188
  # check if user has roles assigned
185
- if @resource.roles.empty?
189
+ unless current_user.roles.exists?
186
190
 
187
191
  log_failure("user_has_no_assigned_role")
188
192
 
@@ -197,7 +201,7 @@ module LesliShield
197
201
  def active_roles?
198
202
 
199
203
  # check user has at least one active role before authorize the sign-in request
200
- unless (@resource.roles.map {|role| role.active}.include? true)
204
+ unless current_user.roles.exists?(active: true)
201
205
  log_failure("user_has_no_active_role")
202
206
 
203
207
  return false
@@ -207,13 +211,7 @@ module LesliShield
207
211
  end
208
212
 
209
213
  def log_failure(description)
210
- @resource.log(
211
- engine: LesliShield,
212
- source: self.class.name,
213
- action: "validate",
214
- operation: "session_creation_failed",
215
- description: description
216
- )
214
+ errors.push(description) unless errors.include?(description)
217
215
  end
218
216
  end
219
217
  end
@@ -1,16 +1,62 @@
1
- <h2>Resend confirmation instructions</h2>
1
+ <%= render(
2
+ "devise/shared/application-devise-simple",
3
+ title: I18n.t("lesli_shield.devise_confirmations.view_title")
4
+ ) do %>
2
5
 
3
- <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
- <%= render "devise/shared/error_messages", resource: resource %>
6
+ <%= form_for(
7
+ resource,
8
+ as: resource_name,
9
+ url: user_confirmation_path,
10
+ html: { method: :post, class: "text-left" },
11
+ builder: LesliView::Forms::Builder
12
+ ) do |form| %>
5
13
 
6
- <div class="field">
7
- <%= f.label :email %><br />
8
- <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9
- </div>
14
+ <p class="mb-6 text-center text-sm leading-6 text-slate-600">
15
+ <%= I18n.t(
16
+ "lesli_shield.devise_confirmations.view_description"
17
+ ) %>
18
+ </p>
10
19
 
11
- <div class="actions">
12
- <%= f.submit "Resend confirmation instructions" %>
13
- </div>
14
- <% end %>
20
+ <%= render "devise/shared/error_messages", resource: resource %>
21
+
22
+ <%= form.field_control_email(
23
+ :email,
24
+ icon: "mail",
25
+ label: I18n.t(
26
+ "lesli_shield.devise_confirmations.field_email"
27
+ ),
28
+ message: resource.errors[:email].to_sentence.presence,
29
+ category: resource.errors[:email].any? ? :danger : nil,
30
+ value: resource.pending_reconfirmation? ?
31
+ resource.unconfirmed_email : resource.email,
32
+ required: true,
33
+ autofocus: true,
34
+ autocomplete: "email",
35
+ autocapitalize: "none",
36
+ spellcheck: false
37
+ ) %>
15
38
 
16
- <%= render "devise/shared/links" %>
39
+ <%= form.field_control_button(
40
+ I18n.t(
41
+ "lesli_shield.devise_confirmations.button_send_instructions"
42
+ ),
43
+ {
44
+ class: "w-full",
45
+ data: {
46
+ turbo_submits_with: I18n.t(
47
+ "lesli_shield.devise_confirmations.button_sending"
48
+ )
49
+ }
50
+ },
51
+ icon: "mark_email_unread"
52
+ ) %>
53
+ <% end %>
54
+
55
+ <%= render(
56
+ "devise/shared/links",
57
+ login: true,
58
+ password_reset: false,
59
+ magic_link: false,
60
+ otp: false
61
+ ) %>
62
+ <% end %>
@@ -1,61 +1,28 @@
1
- <%
2
- =begin
3
-
4
- Lesli
5
-
6
- Copyright (c) 2023, Lesli Technologies, S. A.
7
-
8
- This program is free software: you can redistribute it and/or modify
9
- it under the terms of the GNU General Public License as published by
10
- the Free Software Foundation, either version 3 of the License, or
11
- (at your option) any later version.
12
-
13
- This program is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with this program. If not, see http://www.gnu.org/licenses/.
20
-
21
- Lesli · Ruby on Rails SaaS Development Framework.
22
-
23
- Made with ♥ by https://www.lesli.tech
24
- Building a better future, one line of code at a time.
25
-
26
- @contact hello@lesli.tech
27
- @website https://www.lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
- =end
33
- %>
34
-
35
- <% content_for :application_custom_assets do %>
36
- <script>
37
- //setTimeout(() => { window.location.href = "/"; }, 10000)
38
- </script>
39
- <% end %>
40
-
41
- <%= render("devise/shared/application-devise-simple", title:"Account confirmation") do %>
42
-
43
- <% if flash[:danger] %>
44
- <% flash.each do |type, msg| %>
45
- <div class="notification is-<%= type %>">
46
- <%= msg %>
47
- </div>
48
- <% end %>
49
- <% end %>
50
-
51
- <% if flash[:success] %>
52
- <div class="confirmation-message">
53
- <p>Your account has been successfully verified</p>
54
- </div>
55
- <% end %>
56
-
57
- <%= render("devise/shared/links", login:true) %>
58
-
1
+ <%= render(
2
+ "devise/shared/application-devise-simple",
3
+ title: I18n.t("lesli_shield.devise_confirmations.view_success_title")
4
+ ) do %>
5
+ <section
6
+ class="my-8 w-full max-w-lg rounded-xl border border-emerald-200 bg-white p-8 text-center shadow-sm"
7
+ role="status"
8
+ >
9
+ <span
10
+ class="material-symbols-outlined text-5xl text-emerald-600"
11
+ aria-hidden="true"
12
+ >
13
+ verified
14
+ </span>
15
+
16
+ <p class="mt-4 text-sm leading-6 text-slate-600">
17
+ <%= I18n.t(
18
+ "lesli_shield.devise_confirmations.view_success_description"
19
+ ) %>
20
+ </p>
21
+
22
+ <%= link_to(
23
+ I18n.t("lesli_shield.devise_shared.button_login"),
24
+ new_user_session_path,
25
+ class: "mt-6 inline-flex min-h-11 items-center justify-center rounded-lg bg-[var(--lesli-color-primary)] px-5 py-2.5 text-sm font-semibold text-white transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--lesli-color-primary)]"
26
+ ) %>
27
+ </section>
59
28
  <% end %>
60
-
61
-
@@ -1,36 +1,70 @@
1
- <%= render("devise/shared/application-devise-simple", title:"Password update") do %>
1
+ <%= render(
2
+ "devise/shared/application-devise-simple",
3
+ title: I18n.t("lesli_shield.devise_passwords.view_update_title")
4
+ ) do %>
2
5
 
3
6
  <%= form_for(
4
- resource,
5
- as: resource_name,
6
- url: user_password_path(reset_password_token: params[:reset_password_token]),
7
- html: { class: "has-text-centered", method: :put },
7
+ resource,
8
+ as: resource_name,
9
+ url: user_password_path,
10
+ html: { class: "text-left", method: :put },
8
11
  builder: LesliView::Forms::Builder
9
- ) do |form| %>
12
+ ) do |form| %>
10
13
 
11
- <%= render "devise/shared/error_messages", resource: resource %>
14
+ <p class="mb-6 text-center text-sm leading-6 text-slate-600">
15
+ <%= I18n.t("lesli_shield.devise_passwords.view_update_description") %>
16
+ </p>
12
17
 
13
- <%= form.field_control_builder(
14
- label_html:form.label(:password),
15
- control_html:form.password_field(:password, autocomplete: "current-password", placeholder: "* * * * * *"),
16
- message_text: flash.first&.second,
17
- category: flash.first&.first,
18
- icon: "key"
19
- ) %>
18
+ <%= render "devise/shared/error_messages", resource: resource %>
20
19
 
21
- <%= form.field_control_builder(
22
- label_html:form.label(:password_confirmation),
23
- control_html:form.password_field(:password_confirmation, autocomplete: "current-password", placeholder: "* * * * * *"),
24
- message_text: flash.first&.second,
25
- category: flash.first&.first,
26
- icon: "key"
27
- ) %>
20
+ <%= form.hidden_field :reset_password_token %>
28
21
 
29
- <input type="hidden" name="user[reset_password_token]" value="<%= params[:reset_password_token] %>">
22
+ <%= form.field_control_password(
23
+ :password,
24
+ icon: "key",
25
+ label: I18n.t("lesli_shield.devise_passwords.field_password"),
26
+ message: I18n.t(
27
+ "lesli_shield.devise_passwords.field_password_hint_#{@minimum_password_length == 1 ? 'one' : 'other'}",
28
+ count: @minimum_password_length
29
+ ),
30
+ required: true,
31
+ autofocus: true,
32
+ autocomplete: "new-password",
33
+ minlength: @minimum_password_length,
34
+ value: ""
35
+ ) %>
30
36
 
31
- <%= form.field_control_button("Cambiar contraseña", icon:"key") %>
37
+ <%= form.field_control_password(
38
+ :password_confirmation,
39
+ icon: "key",
40
+ label: I18n.t(
41
+ "lesli_shield.devise_passwords.field_password_confirmation"
42
+ ),
43
+ required: true,
44
+ autocomplete: "new-password",
45
+ minlength: @minimum_password_length,
46
+ value: ""
47
+ ) %>
32
48
 
33
- <% end %>
49
+ <%= form.field_control_button(
50
+ I18n.t("lesli_shield.devise_passwords.button_update_password"),
51
+ {
52
+ class: "is-fullwidth",
53
+ data: {
54
+ turbo_submits_with: I18n.t(
55
+ "lesli_shield.devise_passwords.button_updating"
56
+ )
57
+ }
58
+ },
59
+ icon: "key"
60
+ ) %>
61
+ <% end %>
34
62
 
35
- <%= render("devise/shared/links", login:true, password_reset:false, magic_link:false, otp:false) %>
63
+ <%= render(
64
+ "devise/shared/links",
65
+ login: true,
66
+ password_reset: false,
67
+ magic_link: false,
68
+ otp: false
69
+ ) %>
36
70
  <% end %>
@@ -1,33 +1,68 @@
1
1
 
2
- <%= render("devise/shared/application-devise-simple", title:"Forgot your password?") do %>
2
+ <%= render(
3
+ "devise/shared/application-devise-simple",
4
+ title: I18n.t("lesli_shield.devise_passwords.view_request_title")
5
+ ) do %>
3
6
 
4
7
  <%= form_for(
5
- resource,
6
- as: resource_name,
7
- url: user_password_path(),
8
- html: { class: "has-text-centered" },
8
+ resource,
9
+ as: resource_name,
10
+ url: user_password_path,
11
+ html: { class: "text-left" },
9
12
  builder: LesliView::Forms::Builder
10
- ) do |form| %>
11
-
12
- <%= render "devise/shared/error_messages", resource: resource %>
13
-
14
- <%= form.field_control_email(
15
- :email,
16
- icon: "person_search",
17
- label: "Enter your email address you use in Lesli. We'll send instructions for setting a new password to your email.")
18
- %>
19
-
20
- <%= form.field_control_button("Send me reset password instructions", icon:"mail") %>
21
-
22
- <% if Lesli.config.security.dig(:allow_registration) %>
23
- <p class="account has-text-centered">
24
- Still not registered?
25
- <%= link_to(new_user_registration_path, :class => "has-text-primary") do %>
26
- <u><b>Create account</b></u>
27
- <% end %>
28
- </p>
29
- <% end %>
13
+ ) do |form| %>
14
+
15
+ <p class="mb-6 text-center text-sm leading-6 text-slate-600">
16
+ <%= I18n.t("lesli_shield.devise_passwords.view_request_description") %>
17
+ </p>
18
+
19
+ <%= render "devise/shared/error_messages", resource: resource %>
20
+
21
+ <%= form.field_control_email(
22
+ :email,
23
+ icon: "mail",
24
+ label: I18n.t("lesli_shield.devise_passwords.field_email"),
25
+ required: true,
26
+ autofocus: true,
27
+ autocomplete: "email",
28
+ autocapitalize: "none",
29
+ spellcheck: false
30
+ ) %>
31
+
32
+ <%= form.field_control_button(
33
+ I18n.t("lesli_shield.devise_passwords.button_send_instructions"),
34
+ {
35
+ class: "is-fullwidth",
36
+ data: {
37
+ turbo_submits_with: I18n.t(
38
+ "lesli_shield.devise_passwords.button_sending"
39
+ )
40
+ }
41
+ },
42
+ icon: "mail"
43
+ ) %>
44
+
45
+ <% if Lesli.config.security.dig(:allow_registration) %>
46
+ <p class="mt-6 text-center text-sm text-slate-600">
47
+ <%= I18n.t(
48
+ "lesli_shield.devise_sessions.view_still_not_registered"
49
+ ) %>
50
+ <%= link_to(
51
+ I18n.t(
52
+ "lesli_shield.devise_registrations.button_create_account"
53
+ ),
54
+ new_user_registration_path,
55
+ class: "font-semibold text-[var(--lesli-color-primary)] underline underline-offset-2 hover:opacity-80 focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--lesli-color-primary)]"
56
+ ) %>
57
+ </p>
30
58
  <% end %>
59
+ <% end %>
31
60
 
32
- <%= render("devise/shared/links", login:true, password_reset:false, magic_link:false, otp:false) %>
61
+ <%= render(
62
+ "devise/shared/links",
63
+ login: true,
64
+ password_reset: false,
65
+ magic_link: false,
66
+ otp: false
67
+ ) %>
33
68
  <% end %>