lesli_shield 1.1.6 → 1.1.7

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/app/assets/stylesheets/lesli_shield/application.css +140 -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/passwords.css +872 -18
  7. data/app/assets/stylesheets/lesli_shield/passwords.tailwind.css +873 -0
  8. data/app/assets/stylesheets/lesli_shield/registrations.css +904 -832
  9. data/app/assets/stylesheets/lesli_shield/registrations.tailwind.css +908 -0
  10. data/app/assets/stylesheets/lesli_shield/sessions.css +984 -32
  11. data/app/assets/stylesheets/lesli_shield/sessions.tailwind.css +983 -1
  12. data/app/controllers/lesli_shield/profile/passwords_controller.rb +119 -0
  13. data/app/controllers/lesli_shield/profiles_controller.rb +63 -0
  14. data/app/controllers/lesli_shield/sessions_controller.rb +1 -2
  15. data/app/controllers/users/confirmations_controller.rb +162 -49
  16. data/app/controllers/users/passwords_controller.rb +211 -28
  17. data/app/controllers/users/registrations_controller.rb +108 -83
  18. data/app/controllers/users/sessions_controller.rb +122 -84
  19. data/app/interfaces/lesli_shield/authorization_interface.rb +2 -2
  20. data/app/mailers/lesli_shield/devise_mailer.rb +73 -17
  21. data/app/models/concerns/lesli_shield/user_authentication.rb +54 -0
  22. data/app/models/lesli_shield/account.rb +4 -1
  23. data/app/models/lesli_shield/invite.rb +1 -1
  24. data/app/models/lesli_shield/user/role.rb +1 -1
  25. data/app/models/lesli_shield/user.rb +5 -2
  26. data/app/services/lesli_shield/profile/password_service.rb +47 -0
  27. data/app/services/lesli_shield/profile_service.rb +24 -0
  28. data/app/services/lesli_shield/user_registration_service.rb +41 -74
  29. data/app/services/lesli_shield/user_session_service.rb +1 -1
  30. data/app/services/lesli_shield/user_validator_service.rb +30 -32
  31. data/app/views/devise/confirmations/new.html.erb +58 -12
  32. data/app/views/devise/confirmations/show.html.erb +27 -60
  33. data/app/views/devise/passwords/edit.html.erb +59 -25
  34. data/app/views/devise/passwords/new.html.erb +61 -26
  35. data/app/views/devise/registrations/new.html.erb +80 -53
  36. data/app/views/devise/sessions/new.html.erb +53 -36
  37. data/app/views/devise/shared/_application-devise-simple.erb +18 -19
  38. data/app/views/devise/shared/_demo.html.erb +8 -6
  39. data/app/views/devise/shared/_error_messages.html.erb +45 -10
  40. data/app/views/devise/shared/_links.html.erb +6 -13
  41. data/app/views/lesli_shield/invites/_form.html.erb +1 -1
  42. data/app/views/lesli_shield/invites/index.html.erb +3 -2
  43. data/app/views/lesli_shield/profiles/_password-form.html.erb +68 -0
  44. data/app/views/lesli_shield/profiles/show.html.erb +29 -0
  45. data/app/views/lesli_shield/users/_information-form.html.erb +9 -1
  46. data/config/initializers/devise.rb +52 -328
  47. data/config/locales/translations.en.yml +65 -2
  48. data/config/locales/translations.es.yml +65 -2
  49. data/config/routes.rb +4 -0
  50. data/lib/lesli_shield/engine.rb +38 -4
  51. data/lib/lesli_shield/router.rb +52 -18
  52. data/lib/lesli_shield/version.rb +2 -2
  53. data/readme.md +4 -2
  54. metadata +30 -5
  55. data/app/assets/config/lesli_shield_manifest.js +0 -48
  56. data/app/assets/stylesheets/lesli_shield/application.tailwind.css +0 -2
@@ -0,0 +1,68 @@
1
+ <div id="shield-profile-password-form" class="max-w-2xl">
2
+ <p class="mb-6 text-sm leading-6 text-slate-600">
3
+ <%= I18n.t("lesli_shield.profiles.password_description") %>
4
+ </p>
5
+
6
+ <%= form_with(
7
+ model: user,
8
+ url: profile_password_path,
9
+ method: :patch,
10
+ builder: LesliView::Forms::Builder
11
+ ) do |form| %>
12
+ <%= form.fieldset do %>
13
+ <%= form.field_control_password(
14
+ :current_password,
15
+ label: I18n.t("lesli_shield.profiles.current_password"),
16
+ message: user.errors[:current_password].to_sentence.presence,
17
+ category: user.errors[:current_password].any? ? :danger : nil,
18
+ icon: "lock",
19
+ required: true,
20
+ autocomplete: "current-password",
21
+ value: ""
22
+ ) %>
23
+
24
+ <%= form.field_control_password(
25
+ :password,
26
+ label: I18n.t("lesli_shield.profiles.new_password"),
27
+ message: user.errors[:password].to_sentence.presence ||
28
+ I18n.t(
29
+ "lesli_shield.profiles.password_hint",
30
+ minimum: Devise.password_length.min,
31
+ maximum: Devise.password_length.max
32
+ ),
33
+ category: user.errors[:password].any? ? :danger : nil,
34
+ icon: "key",
35
+ required: true,
36
+ autocomplete: "new-password",
37
+ minlength: Devise.password_length.min,
38
+ maxlength: Devise.password_length.max,
39
+ value: ""
40
+ ) %>
41
+
42
+ <%= form.field_control_password(
43
+ :password_confirmation,
44
+ label: I18n.t("lesli_shield.profiles.password_confirmation"),
45
+ message: user.errors[:password_confirmation].to_sentence.presence,
46
+ category: user.errors[:password_confirmation].any? ? :danger : nil,
47
+ icon: "key",
48
+ required: true,
49
+ autocomplete: "new-password",
50
+ minlength: Devise.password_length.min,
51
+ maxlength: Devise.password_length.max,
52
+ value: ""
53
+ ) %>
54
+
55
+ <%= form.field_control_button(
56
+ I18n.t("lesli_shield.profiles.change_password"),
57
+ {
58
+ data: {
59
+ turbo_submits_with: I18n.t(
60
+ "lesli_shield.profiles.changing_password"
61
+ )
62
+ }
63
+ },
64
+ icon: "key"
65
+ ) %>
66
+ <% end %>
67
+ <% end %>
68
+ </div>
@@ -0,0 +1,29 @@
1
+ <%= render LesliView::Layout::Container.new("shield-profile-show") do %>
2
+ <%= render "lesli_shield/users/information-card" %>
3
+
4
+ <%= render LesliView::Components::Tabs.new(
5
+ active_tab: @active_profile_tab.presence || params[:tab].presence_in(%w[information security]) || "information"
6
+ ) do |tabs| %>
7
+ <% tabs.with_tab(
8
+ id: "information",
9
+ title: I18n.t("lesli_shield.profiles.information"),
10
+ icon: "info"
11
+ ) do %>
12
+ <%= render(
13
+ "lesli_shield/users/information-form",
14
+ form_url: profile_path
15
+ ) %>
16
+ <% end %>
17
+
18
+ <% tabs.with_tab(
19
+ id: "security",
20
+ title: I18n.t("lesli_shield.profiles.security"),
21
+ icon: "lock"
22
+ ) do %>
23
+ <%= render(
24
+ "lesli_shield/profiles/password-form",
25
+ user: @user
26
+ ) %>
27
+ <% end %>
28
+ <% end %>
29
+ <% end %>
@@ -1,4 +1,12 @@
1
- <%= form_with(model: @user, builder: LesliView::Forms::Builder) do |form| %>
1
+ <%
2
+ form_options = {
3
+ model: @user,
4
+ builder: LesliView::Forms::Builder
5
+ }
6
+ form_options[:url] = local_assigns[:form_url] if local_assigns[:form_url]
7
+ %>
8
+
9
+ <%= form_with(**form_options) do |form| %>
2
10
  <%= form.fieldset do %>
3
11
  <%= form.field_control(:alias) %>
4
12
  <%= form.field_control(:title) %>
@@ -1,337 +1,61 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Assuming you have not yet modified this file, each configuration option below
4
- # is set to its default value. Note that some are commented out while others
5
- # are not: uncommented lines are intended to protect your configuration from
6
- # breaking changes in upgrades (i.e., in the event that future versions of
7
- # Devise change the default values for those options).
8
- #
9
- # Use this hook to configure devise mailer, warden hooks and so forth.
10
- # Many of these configuration options can be set straight in your model.
11
- Devise.setup do |config|
12
- # The secret key used by Devise. Devise uses this key to generate
13
- # random tokens. Changing this key will render invalid all existing
14
- # confirmation, reset password and unlock tokens in the database.
15
- # Devise will use the `secret_key_base` as its `secret_key`
16
- # by default. You can change it below and use your own secret key.
17
- # config.secret_key = 'c1d5eb2ef2f445f993dc75916ef80b2fda4c8e6c4b5348dd04aa42be5d1bb3018346749691e6ae1e964def916d4c4eb35171109ce0b0e1cb681bd32260a2e729'
18
-
19
- # ==> Controller configuration
20
- # Configure the parent class to the devise controllers.
21
- # config.parent_controller = 'DeviseController'
22
-
23
- # ==> Mailer Configuration
24
- # Configure the e-mail address which will be shown in Devise::Mailer,
25
- # note that it will be overwritten if you use your own mailer class
26
- # with default "from" parameter.
27
- config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
28
-
29
- # Configure the class responsible to send e-mails.
30
- # config.mailer = 'Devise::Mailer'
31
-
32
- # Configure the parent class responsible to send e-mails.
33
- # config.parent_mailer = 'ActionMailer::Base'
34
-
35
- # ==> ORM configuration
36
- # Load and configure the ORM. Supports :active_record (default) and
37
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
38
- # available as additional gems.
39
- require 'devise/orm/active_record'
40
-
41
- # ==> Configuration for any authentication mechanism
42
- # Configure which keys are used when authenticating a user. The default is
43
- # just :email. You can configure it to use [:username, :subdomain], so for
44
- # authenticating a user, both parameters are required. Remember that those
45
- # parameters are used only when authenticating and not when retrieving from
46
- # session. If you need permissions, you should implement that in a before filter.
47
- # You can also supply a hash where the value is a boolean determining whether
48
- # or not authentication should be aborted when the value is not present.
49
- # config.authentication_keys = [:email]
50
-
51
- # Configure parameters from the request object used for authentication. Each entry
52
- # given should be a request method and it will automatically be passed to the
53
- # find_for_authentication method and considered in your model lookup. For instance,
54
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
55
- # The same considerations mentioned for authentication_keys also apply to request_keys.
56
- # config.request_keys = []
57
-
58
- # Configure which authentication keys should be case-insensitive.
59
- # These keys will be downcased upon creating or modifying a user and when used
60
- # to authenticate or find a user. Default is :email.
61
- config.case_insensitive_keys = [:email]
62
-
63
- # Configure which authentication keys should have whitespace stripped.
64
- # These keys will have whitespace before and after removed upon creating or
65
- # modifying a user and when used to authenticate or find a user. Default is :email.
66
- config.strip_whitespace_keys = [:email]
67
-
68
- # Tell if authentication through request.params is enabled. True by default.
69
- # It can be set to an array that will enable params authentication only for the
70
- # given strategies, for example, `config.params_authenticatable = [:database]` will
71
- # enable it only for database (email + password) authentication.
72
- # config.params_authenticatable = true
73
-
74
- # Tell if authentication through HTTP Auth is enabled. False by default.
75
- # It can be set to an array that will enable http authentication only for the
76
- # given strategies, for example, `config.http_authenticatable = [:database]` will
77
- # enable it only for database authentication.
78
- # For API-only applications to support authentication "out-of-the-box", you will likely want to
79
- # enable this with :database unless you are using a custom strategy.
80
- # The supported strategies are:
81
- # :database = Support basic authentication with authentication key + password
82
- # config.http_authenticatable = false
83
-
84
- # If 401 status code should be returned for AJAX requests. True by default.
85
- # config.http_authenticatable_on_xhr = true
86
-
87
- # The realm used in Http Basic Authentication. 'Application' by default.
88
- # config.http_authentication_realm = 'Application'
89
-
90
- # It will change confirmation, password recovery and other workflows
91
- # to behave the same regardless if the e-mail provided was right or wrong.
92
- # Does not affect registerable.
93
- # config.paranoid = true
94
-
95
- # By default Devise will store the user in session. You can skip storage for
96
- # particular strategies by setting this option.
97
- # Notice that if you are skipping storage for all authentication paths, you
98
- # may want to disable generating routes to Devise's sessions controller by
99
- # passing skip: :sessions to `devise_for` in your config/routes.rb
100
- config.skip_session_storage = [:http_auth]
101
-
102
- # By default, Devise cleans up the CSRF token on authentication to
103
- # avoid CSRF token fixation attacks. This means that, when using AJAX
104
- # requests for sign in and sign up, you need to get a new CSRF token
105
- # from the server. You can disable this option at your own risk.
106
- # config.clean_up_csrf_token_on_authentication = true
107
-
108
- # When false, Devise will not attempt to reload routes on eager load.
109
- # This can reduce the time taken to boot the app but if your application
110
- # requires the Devise mappings to be loaded during boot time the application
111
- # won't boot properly.
112
- # config.reload_routes = true
113
-
114
- # ==> Configuration for :database_authenticatable
115
- # For bcrypt, this is the cost for hashing the password and defaults to 12. If
116
- # using other algorithms, it sets how many times you want the password to be hashed.
117
- # The number of stretches used for generating the hashed password are stored
118
- # with the hashed password. This allows you to change the stretches without
119
- # invalidating existing passwords.
120
- #
121
- # Limiting the stretches to just one in testing will increase the performance of
122
- # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
123
- # a value less than 10 in other environments. Note that, for bcrypt (the default
124
- # algorithm), the cost increases exponentially with the number of stretches (e.g.
125
- # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
126
- config.stretches = Rails.env.test? ? 1 : 12
127
-
128
- # Set up a pepper to generate the hashed password.
129
- # config.pepper = '8eac13c07f5041ea04bd54e18e3388a1c7091ddb5fe41b8f9d40e5fab94e9eeaa09ce0bdcfe56129d0e082a0505d980d4b3215535141c2f777ca278cfd9fd501'
130
-
131
- # Send a notification to the original email when the user's email is changed.
132
- # config.send_email_changed_notification = false
133
-
134
- # Send a notification email when the user's password is changed.
135
- # config.send_password_change_notification = false
136
-
137
- # ==> Configuration for :confirmable
138
- # A period that the user is allowed to access the website even without
139
- # confirming their account. For instance, if set to 2.days, the user will be
140
- # able to access the website for two days without confirming their account,
141
- # access will be blocked just in the third day.
142
- # You can also set it to nil, which will allow the user to access the website
143
- # without confirming their account.
144
- # Default is 0.days, meaning the user cannot access the website without
145
- # confirming their account.
146
- # config.allow_unconfirmed_access_for = 2.days
147
-
148
- # A period that the user is allowed to confirm their account before their
149
- # token becomes invalid. For example, if set to 3.days, the user can confirm
150
- # their account within 3 days after the mail was sent, but on the fourth day
151
- # their account can't be confirmed with the token any more.
152
- # Default is nil, meaning there is no restriction on how long a user can take
153
- # before confirming their account.
154
- # config.confirm_within = 3.days
155
-
156
- # If true, requires any email changes to be confirmed (exactly the same way as
157
- # initial account confirmation) to be applied. Requires additional unconfirmed_email
158
- # db field (see migrations). Until confirmed, new email is stored in
159
- # unconfirmed_email column, and copied to email column on successful confirmation.
160
- # Also, when used in conjunction with `send_email_changed_notification`,
161
- # the notification is sent to the original email when the change is requested,
162
- # not when the unconfirmed email is confirmed.
163
- config.reconfirmable = true
164
-
165
- # Defines which key will be used when confirming an account
166
- # config.confirmation_keys = [:email]
167
-
168
- # ==> Configuration for :rememberable
169
- # The time the user will be remembered without asking for credentials again.
170
- # config.remember_for = 2.weeks
171
-
172
- # Invalidates all the remember me tokens when the user signs out.
173
- config.expire_all_remember_me_on_sign_out = true
174
-
175
- # If true, extends the user's remember period when remembered via cookie.
176
- # config.extend_remember_period = false
177
-
178
- # Options to be passed to the created cookie. For instance, you can set
179
- # secure: true in order to force SSL only cookies.
180
- # config.rememberable_options = {}
181
-
182
- # ==> Configuration for :validatable
183
- # Range for password length.
184
- config.password_length = 6..128
185
-
186
- # Email regex used to validate email formats. It simply asserts that
187
- # one (and only one) @ exists in the given string. This is mainly
188
- # to give user feedback and not to assert the e-mail validity.
189
- config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
190
-
191
- # ==> Configuration for :timeoutable
192
- # The time you want to timeout the user session without activity. After this
193
- # time the user will be asked for credentials again. Default is 30 minutes.
194
- # config.timeout_in = 30.minutes
195
-
196
- # ==> Configuration for :lockable
197
- # Defines which strategy will be used to lock an account.
198
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
199
- # :none = No lock strategy. You should handle locking by yourself.
200
- # config.lock_strategy = :failed_attempts
201
-
202
- # Defines which key will be used when locking and unlocking an account
203
- # config.unlock_keys = [:email]
204
-
205
- # Defines which strategy will be used to unlock an account.
206
- # :email = Sends an unlock link to the user email
207
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
208
- # :both = Enables both strategies
209
- # :none = No unlock strategy. You should handle unlocking by yourself.
210
- # config.unlock_strategy = :both
211
-
212
- # Number of authentication tries before locking an account if lock_strategy
213
- # is failed attempts.
214
- # config.maximum_attempts = 20
215
-
216
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
217
- # config.unlock_in = 1.hour
218
-
219
- # Warn on the last attempt before the account is locked.
220
- # config.last_attempt_warning = true
221
-
222
- # ==> Configuration for :recoverable
223
- #
224
- # Defines which key will be used when recovering the password for an account
225
- # config.reset_password_keys = [:email]
226
-
227
- # Time interval you can reset your password with a reset password key.
228
- # Don't put a too small interval or your users won't have the time to
229
- # change their passwords.
230
- config.reset_password_within = 6.hours
231
-
232
- # When set to false, does not sign a user in automatically after their password is
233
- # reset. Defaults to true, so a user is signed in automatically after a reset.
234
- # config.sign_in_after_reset_password = true
235
-
236
- # ==> Configuration for :encryptable
237
- # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
238
- # You can use :sha1, :sha512 or algorithms from others authentication tools as
239
- # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
240
- # for default behavior) and :restful_authentication_sha1 (then you should set
241
- # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
242
- #
243
- # Require the `devise-encryptable` gem when using anything other than bcrypt
244
- # config.encryptor = :sha512
245
-
246
- # ==> Scopes configuration
247
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
248
- # "users/sessions/new". It's turned off by default because it's slower if you
249
- # are using only default views.
250
- # config.scoped_views = false
251
-
252
- # Configure the default scope given to Warden. By default it's the first
253
- # devise role declared in your routes (usually :user).
254
- # config.default_scope = :user
255
-
256
- # Set this configuration to false if you want /users/sign_out to sign out
257
- # only the current scope. By default, Devise signs out all scopes.
258
- # config.sign_out_all_scopes = true
259
-
260
- # ==> Navigation configuration
261
- # Lists the formats that should be treated as navigational. Formats like
262
- # :html should redirect to the sign in page when the user does not have
263
- # access, but formats like :xml or :json, should return 401.
264
- #
265
- # If you have any extra navigational formats, like :iphone or :mobile, you
266
- # should add them to the navigational formats lists.
267
- #
268
- # The "*/*" below is required to match Internet Explorer requests.
269
- # config.navigational_formats = ['*/*', :html, :turbo_stream]
270
-
271
- # The default HTTP method used to sign out a resource. Default is :delete.
272
- config.sign_out_via = :delete
273
-
274
- # ==> OmniAuth
275
- # Add a new OmniAuth provider. Check the wiki for more information on setting
276
- # up on your models and hooks.
277
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
278
-
279
- # ==> Warden configuration
280
- # If you want to use other strategies, that are not supported by Devise, or
281
- # change the failure app, you can configure them inside the config.warden block.
282
- #
283
- # config.warden do |warden_config|
284
- # warden_config.intercept_401 = false
285
- # warden_config.default_strategies(scope: :user).unshift :some_external_strategy
286
- # end
287
-
288
- # ==> Mountable engine configurations
289
- # When using Devise inside an engine, let's call it `MyEngine`, and this engine
290
- # is mountable, there are some extra configurations to be taken into account.
291
- # The following options are available, assuming the engine is mounted as:
292
- #
293
- # mount MyEngine, at: '/my_engine'
294
- #
295
- # The router that invoked `devise_for`, in the example above, would be:
296
- # config.router_name = :my_engine
297
- #
298
- # When using OmniAuth, Devise cannot automatically set OmniAuth path,
299
- # so you need to do it manually. For the users scope, it would be:
300
- # config.omniauth_path_prefix = '/my_engine/users/auth'
301
-
302
- # ==> Hotwire/Turbo configuration
303
- # When using Devise with Hotwire/Turbo, the http status for error responses
304
- # and some redirects must match the following. The default in Devise for existing
305
- # apps is `200 OK` and `302 Found` respectively, but new apps are generated with
306
- # these new defaults that match Hotwire/Turbo behavior.
307
- # Note: These might become the new default in future versions of Devise.
308
- config.responder.error_status = :unprocessable_content
309
- config.responder.redirect_status = :see_other
310
-
311
- # ==> Configuration for :registerable
312
-
313
- # When set to false, does not sign a user in automatically after their password is
314
- # changed. Defaults to true, so a user is signed in automatically after changing a password.
315
- # config.sign_in_after_change_password = true
316
- end
3
+ require "devise/orm/active_record"
317
4
 
5
+ # LesliShield is one possible authentication provider for Lesli. Because this
6
+ # provider selects Devise, all settings required by that implementation live
7
+ # here rather than in the framework core.
318
8
  Devise.setup do |config|
319
-
320
- config.mailer = "LesliShield::DeviseMailer"
321
-
322
- # Mount devise through Lesli engine
323
- config.router_name = :lesli_shield
324
-
325
- # ==> Controller configuration
326
- # Configure the parent class to the devise controllers.
9
+ # Controllers, routes, and mail delivery
327
10
  config.parent_controller = "Lesli::ApplicationDeviseController"
11
+ config.mailer_sender = (
12
+ ENV["LESLI_MAILER_FROM"].presence ||
13
+ Rails.application.config.action_mailer.default_options&.dig(:from).presence ||
14
+ "no-reply@lesli.dev"
15
+ )
16
+ config.mailer = "LesliShield::DeviseMailer"
17
+ # Authentication routes are intentionally mounted in the host application
18
+ # so every Lesli engine shares the same login. Devise must therefore build
19
+ # its URLs through main_app, not through LesliShield's isolated router.
20
+ config.router_name = :main_app
21
+
22
+ # Authentication keys
23
+ config.case_insensitive_keys = [:email]
24
+ config.strip_whitespace_keys = [:email]
25
+
26
+ # Authentication, recovery, and lock responses must not reveal whether the
27
+ # submitted email belongs to an account.
28
+ config.paranoid = true
29
+
30
+ # Session behavior
31
+ config.skip_session_storage = [:http_auth]
32
+ config.expire_all_remember_me_on_sign_out = true
33
+ config.http_authenticatable_on_xhr = false
34
+ config.navigational_formats = [:html, :json]
328
35
 
329
- # The default HTTP method used to sign out a resource. Default is :delete.
36
+ # The current navigation renders logout as a regular link. Retain GET until
37
+ # those callers are migrated to submit a DELETE request.
330
38
  config.sign_out_via = :get
331
39
 
332
- # If 401 status code should be returned for AJAX requests. True by default.
333
- config.http_authenticatable_on_xhr = false
334
-
335
- # The "*/*" below is required to match Internet Explorer requests.
336
- config.navigational_formats = [:html, :json]
40
+ # Password authentication
41
+ config.stretches = Rails.env.test? ? 1 : 12
42
+ config.password_length = 6..128
43
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
44
+
45
+ # Confirmation and password recovery
46
+ config.reconfirmable = true
47
+ config.confirm_within = 3.hours
48
+ config.reset_password_within = 6.hours
49
+
50
+ # Temporary account locking after repeated failed credentials.
51
+ config.lock_strategy = :failed_attempts
52
+ config.unlock_keys = [:email]
53
+ config.unlock_strategy = :time
54
+ config.maximum_attempts = 5
55
+ config.unlock_in = 15.minutes
56
+ config.last_attempt_warning = false
57
+
58
+ # Rails/Hotwire response semantics
59
+ config.responder.error_status = :unprocessable_content
60
+ config.responder.redirect_status = :see_other
337
61
  end
@@ -3,17 +3,80 @@
3
3
  lesli_shield:
4
4
  devise/sessions:
5
5
  message_not_valid_credentials: Not valid credentials
6
+ message_too_many_attempts: Too many login attempts. Try again later.
6
7
  view_title: Welcome to Lesli
7
8
  button_log_in: Log in
9
+ demo_title: Demo account
10
+ demo_email: Email
11
+ demo_password: Password
8
12
  view_still_not_registered: Still not registered?
9
13
  button_create_account: Create account
10
14
  devise/registrations:
11
15
  view_title: Create an account to discover Lesli
12
- view_password_requirements: 'Password needs to contain:'
13
- view_password_requirements_uppercase: 'Minimum one uppercase letter '
16
+ view_description: Enter your email address and choose a password to create your account.
17
+ view_password_length: Your password must contain between %{minimum} and %{maximum} characters.
18
+ view_legal_notice: By creating an account, you agree to the Terms and acknowledge the Global Privacy Statement.
19
+ label_email: Email address
20
+ label_password: Password
21
+ label_password_confirmation: Confirm password
14
22
  button_create_account: Create account
23
+ button_creating_account: Creating account…
15
24
  view_already_have_an_account: Already have an account?
16
25
  button_login: Log in
26
+ message_registration_not_allowed: Account registration is not available.
27
+ message_too_many_attempts: Too many account creation attempts. Try again later.
28
+ devise/confirmations:
29
+ view_title: Resend confirmation instructions
30
+ view_description: Enter your email address and, if confirmation is still pending, we will send you a new confirmation link.
31
+ view_success_title: Account confirmed
32
+ view_success_description: Your email address was confirmed successfully. You can now log in.
33
+ field_email: Email address
34
+ button_send_instructions: Resend confirmation instructions
35
+ button_sending: Sending instructions…
36
+ message_confirmation_failed: We could not finish confirming your account. Please try the confirmation link again.
37
+ message_too_many_attempts: Too many confirmation requests. Try again later.
38
+ mailer_confirmation_subject: Confirm your email address
39
+ mailer_welcome_subject: Welcome to Lesli
40
+ devise/passwords:
41
+ view_request_title: Forgot your password?
42
+ view_request_description: Enter the email address associated with your account. If the account exists, we will send you a password recovery link.
43
+ view_update_title: Create a new password
44
+ view_update_description: Choose a new password for your account and enter it twice to confirm it.
45
+ field_email: Email address
46
+ field_password: New password
47
+ field_password_confirmation: Confirm new password
48
+ field_password_hint:
49
+ one: Use at least one character.
50
+ other: Use at least %{count} characters.
51
+ button_send_instructions: Send recovery link
52
+ button_sending: Sending…
53
+ button_update_password: Change password
54
+ button_updating: Updating…
55
+ message_too_many_attempts: Too many password recovery attempts. Try again later.
56
+ mailer_subject: Password reset instructions
57
+ devise/shared:
58
+ button_login: Log in
59
+ button_reset_password: Reset password
60
+ button_magic_link: Magic link
61
+ button_one_time_password: One-time password
17
62
  dashboards:
18
63
  view_password_requirements_symbol: One symbol
19
64
  view_password_requirements_number: One number
65
+ profiles:
66
+ information: Information
67
+ security: Security
68
+ password_description: Enter your current password to choose a new one. Changing it will sign out your other sessions.
69
+ current_password: Current password
70
+ new_password: New password
71
+ password_confirmation: Confirm new password
72
+ password_hint: Your password must contain between %{minimum} and %{maximum} characters.
73
+ change_password: Change password
74
+ changing_password: Changing password…
75
+ password_updated: Your password was changed successfully.
76
+ password_too_many_attempts: Too many password change attempts. Try again later.
77
+ devise:
78
+ confirmations:
79
+ confirmed: Your email address has been confirmed successfully. You can now log in.
80
+ send_paranoid_instructions: If your account is awaiting confirmation, you will receive a new confirmation link in a few minutes.
81
+ registrations:
82
+ signed_up_but_invalid: Account created. Check your email to continue.
@@ -3,17 +3,80 @@
3
3
  lesli_shield:
4
4
  devise/sessions:
5
5
  message_not_valid_credentials: Credenciales no validas
6
+ message_too_many_attempts: Demasiados intentos de inicio de sesión. Inténtalo de nuevo más tarde.
6
7
  view_title: ":lesli_shield.devise/sessions.view_title:"
7
8
  button_log_in: Iniciar sesión
9
+ demo_title: Cuenta de demostración
10
+ demo_email: Correo electrónico
11
+ demo_password: Contraseña
8
12
  view_still_not_registered: "¿Aún no tienes cuenta?"
9
13
  button_create_account: Crear cuenta
10
14
  devise/registrations:
11
15
  view_title: Crea una cuenta y descubre Lesli
12
- view_password_requirements: 'La contraseña debe incluir:'
13
- view_password_requirements_uppercase: Una letra mayuscula
16
+ view_description: Ingresa tu correo electrónico y elige una contraseña para crear tu cuenta.
17
+ view_password_length: Tu contraseña debe contener entre %{minimum} y %{maximum} caracteres.
18
+ view_legal_notice: Al crear una cuenta, aceptas los Términos y reconoces la Declaración global de privacidad.
19
+ label_email: Correo electrónico
20
+ label_password: Contraseña
21
+ label_password_confirmation: Confirmar contraseña
14
22
  button_create_account: Crear cuenta
23
+ button_creating_account: Creando cuenta…
15
24
  view_already_have_an_account: "¿Ya tienes cuenta?"
16
25
  button_login: Iniciar sesión
26
+ message_registration_not_allowed: La creación de cuentas no está disponible.
27
+ message_too_many_attempts: Demasiados intentos de creación de cuenta. Inténtalo de nuevo más tarde.
28
+ devise/confirmations:
29
+ view_title: Reenviar instrucciones de confirmación
30
+ view_description: Ingresa tu correo electrónico y, si la confirmación sigue pendiente, te enviaremos un nuevo enlace.
31
+ view_success_title: Cuenta confirmada
32
+ view_success_description: Tu correo electrónico fue confirmado correctamente. Ya puedes iniciar sesión.
33
+ field_email: Correo electrónico
34
+ button_send_instructions: Reenviar instrucciones de confirmación
35
+ button_sending: Enviando instrucciones…
36
+ message_confirmation_failed: No pudimos terminar de confirmar tu cuenta. Intenta utilizar nuevamente el enlace de confirmación.
37
+ message_too_many_attempts: Demasiadas solicitudes de confirmación. Inténtalo de nuevo más tarde.
38
+ mailer_confirmation_subject: Confirma tu correo electrónico
39
+ mailer_welcome_subject: Te damos la bienvenida a Lesli
40
+ devise/passwords:
41
+ view_request_title: "¿Olvidaste tu contraseña?"
42
+ view_request_description: Ingresa el correo electrónico asociado con tu cuenta. Si la cuenta existe, te enviaremos un enlace de recuperación.
43
+ view_update_title: Crea una nueva contraseña
44
+ view_update_description: Elige una nueva contraseña para tu cuenta e ingrésala dos veces para confirmarla.
45
+ field_email: Correo electrónico
46
+ field_password: Nueva contraseña
47
+ field_password_confirmation: Confirmar nueva contraseña
48
+ field_password_hint:
49
+ one: Usa al menos un carácter.
50
+ other: Usa al menos %{count} caracteres.
51
+ button_send_instructions: Enviar enlace de recuperación
52
+ button_sending: Enviando…
53
+ button_update_password: Cambiar contraseña
54
+ button_updating: Actualizando…
55
+ message_too_many_attempts: Demasiados intentos de recuperación de contraseña. Inténtalo de nuevo más tarde.
56
+ mailer_subject: Instrucciones para restablecer tu contraseña
57
+ devise/shared:
58
+ button_login: Iniciar sesión
59
+ button_reset_password: Restablecer contraseña
60
+ button_magic_link: Enlace mágico
61
+ button_one_time_password: Contraseña de un solo uso
17
62
  dashboards:
18
63
  view_password_requirements_symbol: Un caracter especial
19
64
  view_password_requirements_number: Un número
65
+ profiles:
66
+ information: Información
67
+ security: Seguridad
68
+ password_description: Ingresa tu contraseña actual para elegir una nueva. Al cambiarla se cerrarán tus otras sesiones.
69
+ current_password: Contraseña actual
70
+ new_password: Nueva contraseña
71
+ password_confirmation: Confirmar nueva contraseña
72
+ password_hint: Tu contraseña debe contener entre %{minimum} y %{maximum} caracteres.
73
+ change_password: Cambiar contraseña
74
+ changing_password: Cambiando contraseña…
75
+ password_updated: Tu contraseña fue cambiada correctamente.
76
+ password_too_many_attempts: Demasiados intentos de cambio de contraseña. Inténtalo de nuevo más tarde.
77
+ devise:
78
+ confirmations:
79
+ confirmed: Tu correo electrónico fue confirmado correctamente. Ya puedes iniciar sesión.
80
+ send_paranoid_instructions: Si tu cuenta está pendiente de confirmación, recibirás un nuevo enlace en unos minutos.
81
+ registrations:
82
+ signed_up_but_invalid: Cuenta creada. Revisa tu correo electrónico para continuar.