lato 3.23.0 → 3.23.1
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.
- checksums.yaml +4 -4
- data/app/models/lato/user.rb +20 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ro.yml +1 -0
- data/lib/lato/config.rb +4 -0
- data/lib/lato/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 731f545c5ecf6168cae73f2ee10f5c2ba75cd81309e875797f7ea3a4e2e10511
|
|
4
|
+
data.tar.gz: 074c63ac0af5081662ee78b7ae54379208e8fc8e459ff4f4cb901d964f2bbf04
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99fd531e97c8bd89263351d4dbe953bcdb7e39dd6256219faca2e0e5dc480c64b0833b9f293fc71cb28de493bc262dce0bbd5474cf94dd9e44ffa2d6bd723a03
|
|
7
|
+
data.tar.gz: 68cf424eceb523273689aa3da4abb6d8096a3f4e0786efae77fe9e1b235a0ad7d31f0740a4acdfc92cd2ce4e3849405e1c7bca7897c83b37a7f7b9803a7d5ddd
|
data/app/models/lato/user.rb
CHANGED
|
@@ -240,6 +240,12 @@ module Lato
|
|
|
240
240
|
return
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
+
# Global cap checked before user lookup: the error is the same for every email, so it reveals nothing.
|
|
244
|
+
if recover_password_hourly_limit_reached?
|
|
245
|
+
errors.add(:base, :password_update_global_limit)
|
|
246
|
+
return
|
|
247
|
+
end
|
|
248
|
+
|
|
243
249
|
user = Lato::User.find_by(email: email)
|
|
244
250
|
return true unless user
|
|
245
251
|
|
|
@@ -252,6 +258,7 @@ module Lato
|
|
|
252
258
|
|
|
253
259
|
# Async delivery keeps response time independent from email existence.
|
|
254
260
|
Lato::UserMailer.password_update_mail(user.id, code).deliver_later
|
|
261
|
+
Rails.cache.increment(recover_password_hourly_cache_key, 1, expires_in: 1.hour)
|
|
255
262
|
|
|
256
263
|
true
|
|
257
264
|
end
|
|
@@ -451,6 +458,19 @@ module Lato
|
|
|
451
458
|
# Cache
|
|
452
459
|
##
|
|
453
460
|
|
|
461
|
+
# Fixed hourly window shared by all users: stops mass mailing when an attacker knows many registered emails.
|
|
462
|
+
def recover_password_hourly_cache_key
|
|
463
|
+
"Lato::User/recover_password_hourly_count/#{Time.now.utc.strftime('%Y%m%d%H')}"
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
def recover_password_hourly_limit_reached?
|
|
467
|
+
limit = Lato.config.auth_recover_password_hourly_limit
|
|
468
|
+
return false if limit.nil?
|
|
469
|
+
|
|
470
|
+
# raw: true reads counters written by increment on stores that keep them unserialized (Redis, Memcache).
|
|
471
|
+
Rails.cache.read(recover_password_hourly_cache_key, raw: true).to_i >= limit
|
|
472
|
+
end
|
|
473
|
+
|
|
454
474
|
def c_email_verification_semaphore(value = nil)
|
|
455
475
|
cache_key = "Lato::User/c_email_verification_semaphore/#{id}"
|
|
456
476
|
return Rails.cache.read(cache_key) if value.nil?
|
data/config/locales/en.yml
CHANGED
|
@@ -140,6 +140,7 @@ en:
|
|
|
140
140
|
email_verification_code_invalid: Email verification code is invalid
|
|
141
141
|
password_update_code_expired: Verification code has expired
|
|
142
142
|
password_update_code_invalid: Verification code is invalid or expired
|
|
143
|
+
password_update_global_limit: Too many password recovery requests, please retry later
|
|
143
144
|
credentials_not_correct: Email or password not correct
|
|
144
145
|
privacy_policy_invalid: To accept the privacy policy you must select the confirmation checkbox
|
|
145
146
|
terms_and_conditions_invalid: To accept the terms and conditions you must select the confirmation checkbox
|
data/config/locales/fr.yml
CHANGED
|
@@ -147,6 +147,7 @@ fr:
|
|
|
147
147
|
email_verification_code_invalid: Le code de vérification de l'e-mail n'est pas valide
|
|
148
148
|
password_update_code_expired: Le code de vérification a expiré
|
|
149
149
|
password_update_code_invalid: Le code de vérification n'est pas valide ou a expiré
|
|
150
|
+
password_update_global_limit: Trop de demandes de récupération de mot de passe, veuillez réessayer plus tard
|
|
150
151
|
credentials_not_correct: E-mail ou mot de passe incorrect
|
|
151
152
|
privacy_policy_invalid: Pour accepter la politique de confidentialité, vous devez cocher la case de confirmation
|
|
152
153
|
terms_and_conditions_invalid: Pour accepter les conditions générales, vous devez cocher la case de confirmation
|
data/config/locales/it.yml
CHANGED
|
@@ -147,6 +147,7 @@ it:
|
|
|
147
147
|
email_verification_code_invalid: Il codice di verifica email non risulta valido
|
|
148
148
|
password_update_code_expired: Il codice di verifica risulta scaduto
|
|
149
149
|
password_update_code_invalid: Il codice di verifica non risulta valido o è scaduto
|
|
150
|
+
password_update_global_limit: Troppe richieste di recupero password, riprova più tardi
|
|
150
151
|
credentials_not_correct: Email o password non corretti
|
|
151
152
|
privacy_policy_invalid: Per accettare la privacy policy devi selezionare la checkbox di conferma
|
|
152
153
|
terms_and_conditions_invalid: Per accettare i termini e condizioni devi selezionare la checkbox di conferma
|
data/config/locales/ro.yml
CHANGED
|
@@ -147,6 +147,7 @@ ro:
|
|
|
147
147
|
email_verification_code_invalid: Codul de verificare email nu este valid
|
|
148
148
|
password_update_code_expired: Codul de verificare a expirat
|
|
149
149
|
password_update_code_invalid: Codul de verificare nu este valid sau a expirat
|
|
150
|
+
password_update_global_limit: Prea multe cereri de recuperare a parolei, încearcă din nou mai târziu
|
|
150
151
|
credentials_not_correct: Email sau parolă incorectă
|
|
151
152
|
privacy_policy_invalid: Pentru a accepta politica de confidențialitate trebuie să bifezi căsuța de confirmare
|
|
152
153
|
terms_and_conditions_invalid: Pentru a accepta termenii și condițiile trebuie să bifezi căsuța de confirmare
|
data/lib/lato/config.rb
CHANGED
|
@@ -12,6 +12,9 @@ module Lato
|
|
|
12
12
|
# Authentication configs
|
|
13
13
|
attr_accessor :auth_disable_signup, :auth_disable_recover_password, :auth_disable_web3, :auth_disable_authenticator, :auth_disable_webauthn, :auth_disable_signin_success_mail
|
|
14
14
|
|
|
15
|
+
# Max password recovery emails sent per hour across all users (nil disables the cap)
|
|
16
|
+
attr_accessor :auth_recover_password_hourly_limit
|
|
17
|
+
|
|
15
18
|
# Hcaptcha configs
|
|
16
19
|
attr_accessor :hcaptcha_site_key, :hcaptcha_secret
|
|
17
20
|
|
|
@@ -49,6 +52,7 @@ module Lato
|
|
|
49
52
|
@auth_disable_authenticator = false
|
|
50
53
|
@auth_disable_webauthn = false
|
|
51
54
|
@auth_disable_signin_success_mail = false
|
|
55
|
+
@auth_recover_password_hourly_limit = 100
|
|
52
56
|
|
|
53
57
|
@hcaptcha_site_key = nil
|
|
54
58
|
@hcaptcha_secret = nil
|
data/lib/lato/version.rb
CHANGED