devise-security 0.16.0 → 0.18.0
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/LICENSE.txt +3 -1
- data/README.md +18 -7
- data/app/controllers/devise/paranoid_verification_code_controller.rb +26 -12
- data/app/controllers/devise/password_expired_controller.rb +22 -5
- data/config/locales/bg.yml +42 -0
- data/config/locales/by.yml +1 -0
- data/config/locales/cs.yml +5 -0
- data/config/locales/de.yml +3 -0
- data/config/locales/en.yml +2 -1
- data/config/locales/es.yml +12 -0
- data/config/locales/fa.yml +1 -0
- data/config/locales/fr.yml +14 -2
- data/config/locales/hi.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +12 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/pt.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/tr.yml +25 -1
- data/config/locales/uk.yml +1 -0
- data/config/locales/zh_CN.yml +1 -0
- data/config/locales/zh_TW.yml +1 -0
- data/lib/devise-security/controllers/helpers.rb +23 -11
- data/lib/devise-security/hooks/expirable.rb +3 -3
- data/lib/devise-security/hooks/paranoid_verification.rb +1 -3
- data/lib/devise-security/hooks/password_expirable.rb +1 -3
- data/lib/devise-security/hooks/session_limitable.rb +4 -4
- data/lib/devise-security/models/compatibility/active_record_patch.rb +4 -3
- data/lib/devise-security/models/compatibility/mongoid_patch.rb +3 -2
- data/lib/devise-security/models/database_authenticatable_patch.rb +18 -10
- data/lib/devise-security/models/expirable.rb +6 -5
- data/lib/devise-security/models/paranoid_verification.rb +2 -2
- data/lib/devise-security/models/password_archivable.rb +3 -3
- data/lib/devise-security/models/secure_validatable.rb +57 -20
- data/lib/devise-security/orm/mongoid.rb +1 -1
- data/lib/devise-security/patches.rb +14 -8
- data/lib/devise-security/routes.rb +2 -3
- data/lib/devise-security/validators/password_complexity_validator.rb +53 -26
- data/lib/devise-security/version.rb +1 -1
- data/lib/devise-security.rb +9 -3
- data/lib/generators/devise_security/install_generator.rb +3 -5
- data/lib/generators/templates/devise_security.rb +6 -1
- data/test/controllers/test_paranoid_verification_code_controller.rb +133 -0
- data/test/controllers/test_password_expired_controller.rb +87 -33
- data/test/controllers/test_security_question_controller.rb +25 -19
- data/test/dummy/app/controllers/overrides/paranoid_verification_code_controller.rb +7 -0
- data/test/dummy/app/controllers/overrides/password_expired_controller.rb +17 -0
- data/test/dummy/app/controllers/widgets_controller.rb +3 -0
- data/test/dummy/app/models/application_user_record.rb +2 -1
- data/test/dummy/app/models/mongoid/confirmable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/database_authenticable_fields.rb +4 -3
- data/test/dummy/app/models/mongoid/expirable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/lockable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/mappings.rb +4 -2
- data/test/dummy/app/models/mongoid/omniauthable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/paranoid_verification_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/password_archivable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/password_expirable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/recoverable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/registerable_fields.rb +4 -2
- data/test/dummy/app/models/mongoid/rememberable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/secure_validatable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/security_questionable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/session_limitable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/timeoutable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/trackable_fields.rb +2 -0
- data/test/dummy/app/models/mongoid/validatable_fields.rb +2 -0
- data/test/dummy/app/models/paranoid_verification_user.rb +26 -0
- data/test/dummy/app/models/password_expired_user.rb +26 -0
- data/test/dummy/app/models/user.rb +5 -5
- data/test/dummy/app/models/widget.rb +1 -3
- data/test/dummy/app/mongoid/one_user.rb +5 -5
- data/test/dummy/app/mongoid/user_on_engine.rb +2 -2
- data/test/dummy/app/mongoid/user_on_main_app.rb +2 -2
- data/test/dummy/app/mongoid/user_with_validations.rb +3 -3
- data/test/dummy/app/mongoid/user_without_email.rb +7 -4
- data/test/dummy/config/application.rb +3 -7
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/test.rb +1 -0
- data/test/dummy/config/initializers/devise.rb +1 -5
- data/test/dummy/config/locales/en.yml +10 -0
- data/test/dummy/config/routes.rb +3 -1
- data/test/dummy/config.ru +1 -1
- data/test/dummy/db/migrate/20120508165529_create_tables.rb +5 -5
- data/test/dummy/lib/shared_expirable_columns.rb +1 -0
- data/test/dummy/lib/shared_security_questions_fields.rb +1 -0
- data/test/dummy/lib/shared_user.rb +17 -6
- data/test/dummy/lib/shared_user_without_omniauth.rb +12 -3
- data/test/dummy/lib/shared_verification_fields.rb +1 -0
- data/test/dummy/log/test.log +39637 -16086
- data/test/i18n_test.rb +22 -0
- data/test/integration/test_paranoid_verification_code_workflow.rb +53 -0
- data/test/integration/test_password_expirable_workflow.rb +2 -2
- data/test/integration/test_session_limitable_workflow.rb +5 -3
- data/test/orm/active_record.rb +7 -7
- data/test/support/integration_helpers.rb +18 -12
- data/test/test_compatibility.rb +2 -0
- data/test/test_complexity_validator.rb +247 -37
- data/test/test_database_authenticatable_patch.rb +146 -0
- data/test/test_helper.rb +7 -8
- data/test/test_install_generator.rb +1 -1
- data/test/test_paranoid_verification.rb +8 -9
- data/test/test_password_archivable.rb +34 -11
- data/test/test_password_expirable.rb +27 -27
- data/test/test_secure_validatable.rb +265 -107
- data/test/test_secure_validatable_overrides.rb +185 -0
- data/test/test_session_limitable.rb +9 -9
- data/test/tmp/config/initializers/{devise-security.rb → devise_security.rb} +6 -1
- data/test/tmp/config/locales/devise.security_extension.by.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.cs.yml +5 -0
- data/test/tmp/config/locales/devise.security_extension.de.yml +3 -0
- data/test/tmp/config/locales/devise.security_extension.en.yml +2 -1
- data/test/tmp/config/locales/devise.security_extension.es.yml +12 -0
- data/test/tmp/config/locales/devise.security_extension.fa.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.fr.yml +14 -2
- data/test/tmp/config/locales/devise.security_extension.hi.yml +21 -20
- data/test/tmp/config/locales/devise.security_extension.it.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.ja.yml +12 -0
- data/test/tmp/config/locales/devise.security_extension.nl.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.pt.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.ru.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.tr.yml +25 -1
- data/test/tmp/config/locales/devise.security_extension.uk.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.zh_CN.yml +1 -0
- data/test/tmp/config/locales/devise.security_extension.zh_TW.yml +1 -0
- metadata +82 -41
- data/lib/devise-security/patches/confirmations_controller_captcha.rb +0 -23
- data/lib/devise-security/patches/confirmations_controller_security_question.rb +0 -26
- data/lib/devise-security/patches/passwords_controller_captcha.rb +0 -22
- data/lib/devise-security/patches/passwords_controller_security_question.rb +0 -25
- data/lib/devise-security/patches/registrations_controller_captcha.rb +0 -35
- data/lib/devise-security/patches/sessions_controller_captcha.rb +0 -26
- data/lib/devise-security/patches/unlocks_controller_captcha.rb +0 -22
- data/lib/devise-security/patches/unlocks_controller_security_question.rb +0 -25
- data/test/dummy/app/controllers/foos_controller.rb +0 -0
- data/test/dummy/app/models/secure_user.rb +0 -9
- data/test/dummy/lib/shared_user_without_email.rb +0 -28
- data/test/dummy/log/development.log +0 -883
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30c17693a3331769b786cf6925dcce0b62087a894960309ad316189613b62291
|
|
4
|
+
data.tar.gz: defa2b29a2d67e7615062ab6bea7518b37b6f24ed4735016a4fca4ef860ffbd0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54fa56d5e200c73e329d1f07eb1845ce2be695ffb4afa20f475d624fb6615f1583a161c8eec8fa5f84643b957a0d9e4d4d653d5f5071f7b73784bf843a520a70
|
|
7
|
+
data.tar.gz: 891fcf2b29571ee6fca9d667ddbc211cf27a5ba64e6048b33d3f63a6f395e02ef88d51a6c35da3bfe761b42c04bf1a57e118ae9bb46ebb22212eb85f9a0b3179
|
data/LICENSE.txt
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2017-2022 Dillon Welch & Kevin Olbrich.
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011-2017 Marco Scholl
|
|
2
4
|
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Devise Security
|
|
2
2
|
|
|
3
|
-
[](https://github.com/devise-security/devise-security/actions/workflows/test_suite.yml)
|
|
4
4
|
[](https://coveralls.io/github/devise-security/devise-security?branch=master)
|
|
5
5
|
[](https://codeclimate.com/github/devise-security/devise-security/maintainability)
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ automated mass creation and brute forcing of accounts harder)
|
|
|
37
37
|
|
|
38
38
|
## Getting started
|
|
39
39
|
|
|
40
|
-
Devise Security works with Devise on Rails >= 5.
|
|
40
|
+
Devise Security works with Devise on Rails >= 5.2. You can add it to your
|
|
41
41
|
Gemfile after you successfully set up Devise (see
|
|
42
42
|
[Devise documentation](https://github.com/heartcombo/devise)) with:
|
|
43
43
|
|
|
@@ -89,6 +89,8 @@ Devise.setup do |config|
|
|
|
89
89
|
# config.expire_password_after = 3.months | true | false
|
|
90
90
|
|
|
91
91
|
# Need 1 char each of: A-Z, a-z, 0-9, and a punctuation mark or symbol
|
|
92
|
+
# You may use "digits" in place of "digit" and "symbols" in place of
|
|
93
|
+
# "symbol" based on your preference
|
|
92
94
|
# config.password_complexity = { digit: 1, lower: 1, symbol: 1, upper: 1 }
|
|
93
95
|
|
|
94
96
|
# Number of old passwords in archive
|
|
@@ -127,6 +129,9 @@ Devise.setup do |config|
|
|
|
127
129
|
|
|
128
130
|
# Allow passwords to be equal to email (false, true)
|
|
129
131
|
# config.allow_passwords_equal_to_email = false
|
|
132
|
+
|
|
133
|
+
# paranoid_verification will regenerate verification code after failed attempt
|
|
134
|
+
# config.paranoid_code_regenerate_after_attempt = 10
|
|
130
135
|
end
|
|
131
136
|
```
|
|
132
137
|
|
|
@@ -321,7 +326,7 @@ end
|
|
|
321
326
|
## Requirements
|
|
322
327
|
|
|
323
328
|
- Devise (<https://github.com/heartcombo/devise>)
|
|
324
|
-
- Rails 5.
|
|
329
|
+
- Rails 5.2 onwards (<http://github.com/rails/rails>)
|
|
325
330
|
- recommendations:
|
|
326
331
|
- `autocomplete-off` (<http://github.com/phatworx/autocomplete-off>)
|
|
327
332
|
- `easy_captcha` (<http://github.com/phatworx/easy_captcha>)
|
|
@@ -375,17 +380,23 @@ Standard tests can be invoked using `rake`. To run the tests against the
|
|
|
375
380
|
|
|
376
381
|
## Maintenance Policy
|
|
377
382
|
|
|
378
|
-
We are committed to
|
|
383
|
+
We are committed to maintaining support for `devise-security` for all normal or
|
|
379
384
|
security maintenance versions of the Ruby language
|
|
380
385
|
[as listed here](https://www.ruby-lang.org/en/downloads/branches/), and for the
|
|
381
386
|
Ruby on Rails framework
|
|
382
387
|
[as per their maintenance policy](https://rubyonrails.org/maintenance/).
|
|
383
388
|
|
|
384
|
-
|
|
389
|
+
To avoid introducing bugs caused by backwardly incompatible Ruby
|
|
385
390
|
language features, it is highly recommended that all development work be done
|
|
386
|
-
using the oldest supported
|
|
391
|
+
using the oldest supported Ruby version. The contents of the `.ruby-version`
|
|
387
392
|
file should reflect this.
|
|
388
393
|
|
|
389
394
|
## Copyright
|
|
390
395
|
|
|
391
|
-
Copyright (c)
|
|
396
|
+
Copyright (c) 2017-2023 Dillon Welch & Kevin Olbrich.
|
|
397
|
+
|
|
398
|
+
Copyright (c) 2011-2017 Marco Scholl as the project [`devise_security_extension`](https://github.com/phatworx/devise_security_extension).
|
|
399
|
+
|
|
400
|
+
This repo was created as a fork from [b2ee978a](https://github.com/phatworx/devise_security_extension/commit/b2ee978af7d49f0fb0e7271c6ac074dfb4d39353).
|
|
401
|
+
|
|
402
|
+
See LICENSE.txt for further details.
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class Devise::ParanoidVerificationCodeController < DeviseController
|
|
4
|
+
before_action :verify_requested_format!
|
|
4
5
|
skip_before_action :handle_paranoid_verification
|
|
5
|
-
|
|
6
|
+
before_action :skip_paranoid_verification, only: %i[show update]
|
|
7
|
+
prepend_before_action :authenticate_scope!, only: %i[show update]
|
|
6
8
|
|
|
7
9
|
def show
|
|
8
|
-
|
|
9
|
-
respond_with(resource)
|
|
10
|
-
else
|
|
11
|
-
redirect_to :root
|
|
12
|
-
end
|
|
10
|
+
respond_with(resource)
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
def update
|
|
@@ -17,20 +15,36 @@ class Devise::ParanoidVerificationCodeController < DeviseController
|
|
|
17
15
|
warden.session(scope)['paranoid_verify'] = false
|
|
18
16
|
set_flash_message :notice, :updated
|
|
19
17
|
bypass_sign_in resource, scope: scope
|
|
20
|
-
|
|
18
|
+
respond_with({}, location: after_paranoid_verification_code_update_path_for(resource))
|
|
21
19
|
else
|
|
22
20
|
respond_with(resource, action: :show)
|
|
23
21
|
end
|
|
24
22
|
end
|
|
25
23
|
|
|
24
|
+
# Allows you to customize where the user is redirected to after the update action
|
|
25
|
+
# successfully completes.
|
|
26
|
+
#
|
|
27
|
+
# Defaults to the request's original path, and then `root` if that is `nil`.
|
|
28
|
+
#
|
|
29
|
+
# @param resource [ActiveModel::Model] Devise `resource` model for logged in user.
|
|
30
|
+
#
|
|
31
|
+
# @return [String, Symbol] The path that the user will be redirected to.
|
|
32
|
+
def after_paranoid_verification_code_update_path_for(_resource)
|
|
33
|
+
stored_location_for(scope) || :root
|
|
34
|
+
end
|
|
35
|
+
|
|
26
36
|
private
|
|
27
37
|
|
|
38
|
+
def skip_paranoid_verification
|
|
39
|
+
return if !resource.nil? && resource.need_paranoid_verification?
|
|
40
|
+
|
|
41
|
+
redirect_to :root
|
|
42
|
+
end
|
|
43
|
+
|
|
28
44
|
def resource_params
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
params[scope].slice(:paranoid_verification_code)
|
|
33
|
-
end
|
|
45
|
+
permitted_params = %i[paranoid_verification_code]
|
|
46
|
+
|
|
47
|
+
params.require(resource_name).permit(*permitted_params)
|
|
34
48
|
end
|
|
35
49
|
|
|
36
50
|
def scope
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
class Devise::PasswordExpiredController < DeviseController
|
|
4
4
|
before_action :verify_requested_format!
|
|
5
5
|
skip_before_action :handle_password_change
|
|
6
|
-
before_action :skip_password_change, only: [
|
|
7
|
-
prepend_before_action :authenticate_scope!, only: [
|
|
6
|
+
before_action :skip_password_change, only: %i[show update]
|
|
7
|
+
prepend_before_action :authenticate_scope!, only: %i[show update]
|
|
8
8
|
|
|
9
9
|
def show
|
|
10
10
|
respond_with(resource)
|
|
@@ -20,26 +20,43 @@ class Devise::PasswordExpiredController < DeviseController
|
|
|
20
20
|
# @see https://github.com/devise-security/devise-security/pull/111
|
|
21
21
|
def update
|
|
22
22
|
resource.extend(Devise::Models::DatabaseAuthenticatablePatch)
|
|
23
|
-
|
|
23
|
+
resource.update_with_password(resource_params)
|
|
24
|
+
|
|
25
|
+
yield resource if block_given?
|
|
26
|
+
|
|
27
|
+
if resource.errors.empty?
|
|
24
28
|
warden.session(scope)['password_expired'] = false
|
|
25
29
|
set_flash_message :notice, :updated
|
|
26
30
|
bypass_sign_in resource, scope: scope
|
|
27
|
-
respond_with({}, location:
|
|
31
|
+
respond_with({}, location: after_password_expired_update_path_for(resource))
|
|
28
32
|
else
|
|
29
33
|
clean_up_passwords(resource)
|
|
30
34
|
respond_with(resource, action: :show)
|
|
31
35
|
end
|
|
32
36
|
end
|
|
33
37
|
|
|
38
|
+
# Allows you to customize where the user is sent to after the update action
|
|
39
|
+
# successfully completes.
|
|
40
|
+
#
|
|
41
|
+
# Defaults to the request's original path, and then `root` if that is `nil`.
|
|
42
|
+
#
|
|
43
|
+
# @param resource [ActiveModel::Model] Devise `resource` model for logged in user.
|
|
44
|
+
#
|
|
45
|
+
# @return [String, Symbol] The path that the user will be sent to.
|
|
46
|
+
def after_password_expired_update_path_for(_resource)
|
|
47
|
+
stored_location_for(scope) || :root
|
|
48
|
+
end
|
|
49
|
+
|
|
34
50
|
private
|
|
35
51
|
|
|
36
52
|
def skip_password_change
|
|
37
53
|
return if !resource.nil? && resource.need_change_password?
|
|
54
|
+
|
|
38
55
|
redirect_to :root
|
|
39
56
|
end
|
|
40
57
|
|
|
41
58
|
def resource_params
|
|
42
|
-
permitted_params = [
|
|
59
|
+
permitted_params = %i[current_password password password_confirmation]
|
|
43
60
|
|
|
44
61
|
params.require(resource_name).permit(*permitted_params)
|
|
45
62
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
bg:
|
|
2
|
+
errors:
|
|
3
|
+
messages:
|
|
4
|
+
taken_in_past: 'е използвана и преди.'
|
|
5
|
+
equal_to_current_password: 'трябва да е различна от настоящата парола.'
|
|
6
|
+
equal_to_email: 'трябва да е различна от e-mail адреса.'
|
|
7
|
+
password_complexity:
|
|
8
|
+
digit:
|
|
9
|
+
one: трябва да съдържа поне една цифра
|
|
10
|
+
other: трябва да съдържа %{count} цифри
|
|
11
|
+
lower:
|
|
12
|
+
one: трябва да съдържа поне една малка буква
|
|
13
|
+
other: трябва да съдържа поне %{count} малки букви
|
|
14
|
+
symbol:
|
|
15
|
+
one: трябва да съдържа поне един пунктоационен знак или символ
|
|
16
|
+
other: трябва да съдържа поне %{count} пунктоационни знака или символи
|
|
17
|
+
upper:
|
|
18
|
+
one: трябва да съдържа поне една главна буква
|
|
19
|
+
other: трябва да съдържа поне %{count} главни букви
|
|
20
|
+
devise:
|
|
21
|
+
invalid_captcha: 'Кодът е грешен.'
|
|
22
|
+
invalid_security_question: 'Отговора на тайния въпрос е грешен.'
|
|
23
|
+
paranoid_verify:
|
|
24
|
+
code_required: 'Моля въведете кода, който нашия екип по поддръжката Ви е предоставил'
|
|
25
|
+
paranoid_verification_code:
|
|
26
|
+
updated: Кодът за потвърждение е приет
|
|
27
|
+
show:
|
|
28
|
+
submit_verification_code: Изпрати код за потвърждение
|
|
29
|
+
verification_code: Код за потвърждение
|
|
30
|
+
submit: Изпрати
|
|
31
|
+
password_expired:
|
|
32
|
+
updated: 'Вашата нова парола е запазена.'
|
|
33
|
+
change_required: 'Вашата парола е изтекла. Моля подновете паролата си.'
|
|
34
|
+
show:
|
|
35
|
+
renew_your_password: Подновете паролата си
|
|
36
|
+
current_password: Настояща парола
|
|
37
|
+
new_password: Нова парола
|
|
38
|
+
new_password_confirmation: Потвърждение на нова парола
|
|
39
|
+
change_my_password: Промени паролата ми
|
|
40
|
+
failure:
|
|
41
|
+
session_limited: 'Вашето потребителско име и парола са използвани в друг браузър. Моля влезте отново за да продължите в този браузър.'
|
|
42
|
+
expired: 'Вашия акаунт е затворен поради неактивност. Моля свържете се с администратор.'
|
data/config/locales/by.yml
CHANGED
|
@@ -31,6 +31,7 @@ by:
|
|
|
31
31
|
paranoid_verify:
|
|
32
32
|
code_required: 'Калі ласка, увядзіце код, атрыманы ад нашай каманды падтрымкі'
|
|
33
33
|
paranoid_verification_code:
|
|
34
|
+
updated: Код спраўджання прыняты
|
|
34
35
|
show:
|
|
35
36
|
submit_verification_code: 'Увод кода пацверджання'
|
|
36
37
|
verification_code: 'Код пацверджання'
|
data/config/locales/cs.yml
CHANGED
|
@@ -7,15 +7,19 @@ cs:
|
|
|
7
7
|
password_complexity:
|
|
8
8
|
digit:
|
|
9
9
|
one: musí obsahovat alespoň jednu číslici
|
|
10
|
+
few: musí obsahovat alespoň %{count} číslice
|
|
10
11
|
other: musí obsahovat alespoň %{count} číslice
|
|
11
12
|
lower:
|
|
12
13
|
one: musí obsahovat alespoň jedno malé písmeno
|
|
14
|
+
few: musí obsahovat alespoň %{count} malé písmena
|
|
13
15
|
other: musí obsahovat alespoň %{count} malé písmena
|
|
14
16
|
symbol:
|
|
15
17
|
one: musí obsahovat alespoň jedno interpunkční znaménko nebo symbol
|
|
18
|
+
few: musí obsahovat alespoň %{count} interpunkční znaménka nebo symboly
|
|
16
19
|
other: musí obsahovat alespoň %{count} interpunkční znaménka nebo symboly
|
|
17
20
|
upper:
|
|
18
21
|
one: musí obsahovat alespoň jedno velké písmeno
|
|
22
|
+
few: musí obsahovat alespoň %{count} velké písmena
|
|
19
23
|
other: musí obsahovat alespoň %{count} velké písmena
|
|
20
24
|
devise:
|
|
21
25
|
invalid_captcha: Chybná captcha.
|
|
@@ -23,6 +27,7 @@ cs:
|
|
|
23
27
|
paranoid_verify:
|
|
24
28
|
code_required: Zadejte kód, který poskytla naše podpora
|
|
25
29
|
paranoid_verification_code:
|
|
30
|
+
updated: Ověřovací kód přijat
|
|
26
31
|
show:
|
|
27
32
|
submit_verification_code: Odeslat ověřovací kód
|
|
28
33
|
verification_code: Ověřovací kód
|
data/config/locales/de.yml
CHANGED
|
@@ -19,8 +19,11 @@ de:
|
|
|
19
19
|
other: muss mindestens %{count} Großbuchstaben enthalten
|
|
20
20
|
devise:
|
|
21
21
|
invalid_captcha: 'Die Captcha-Eingabe ist nicht gültig.'
|
|
22
|
+
invalid_security_question: 'Die Antwort auf die Sicherheitsfrage war ungültig.'
|
|
22
23
|
paranoid_verify:
|
|
23
24
|
code_required: 'Bitte geben Sie den Code ein, den unser Support-Team zur Verfügung gestellt hat.'
|
|
25
|
+
paranoid_verification_code:
|
|
26
|
+
updated: Bestätigungscode akzeptiert
|
|
24
27
|
show:
|
|
25
28
|
submit_verification_code: Bestätigungscode eingeben
|
|
26
29
|
verification_code: Bestätigungscode
|
data/config/locales/en.yml
CHANGED
|
@@ -7,7 +7,7 @@ en:
|
|
|
7
7
|
password_complexity:
|
|
8
8
|
digit:
|
|
9
9
|
one: must contain at least one digit
|
|
10
|
-
other: must contain at least %{count}
|
|
10
|
+
other: must contain at least %{count} digits
|
|
11
11
|
lower:
|
|
12
12
|
one: must contain at least one lower-case letter
|
|
13
13
|
other: must contain at least %{count} lower-case letters
|
|
@@ -23,6 +23,7 @@ en:
|
|
|
23
23
|
paranoid_verify:
|
|
24
24
|
code_required: 'Please enter the code our support team provided'
|
|
25
25
|
paranoid_verification_code:
|
|
26
|
+
updated: Verification code accepted
|
|
26
27
|
show:
|
|
27
28
|
submit_verification_code: Submit verification code
|
|
28
29
|
verification_code: Verification code
|
data/config/locales/es.yml
CHANGED
|
@@ -22,9 +22,21 @@ es:
|
|
|
22
22
|
invalid_security_question: 'La respuesta a la pregunta de seguridad fue incorrecta.'
|
|
23
23
|
paranoid_verify:
|
|
24
24
|
code_required: 'Por favor ingrese el código provisto por nuestro equipo de soporte'
|
|
25
|
+
paranoid_verification_code:
|
|
26
|
+
updated: Se acepta el código de verificación
|
|
27
|
+
show:
|
|
28
|
+
submit_verification_code: Envíe el código de verificación
|
|
29
|
+
verification_code: Código de verificación
|
|
30
|
+
submit: Entregar
|
|
25
31
|
password_expired:
|
|
26
32
|
updated: 'Su nueva contraseña ha sido guardada.'
|
|
27
33
|
change_required: 'Su contraseña ha expirado. Por favor renueve su contraseña.'
|
|
34
|
+
show:
|
|
35
|
+
renew_your_password: Renueve su contraseña
|
|
36
|
+
current_password: Actual contraseña
|
|
37
|
+
new_password: Nueva contraseña
|
|
38
|
+
new_password_confirmation: Confirmar nueva contraseña
|
|
39
|
+
change_my_password: Cambiar mi contraseña
|
|
28
40
|
failure:
|
|
29
41
|
session_limited: 'Sus credenciales de inicio de sesión fueron usadas en otro navegador. Por favor inicie sesión nuevamente para continuar en este navegador.'
|
|
30
42
|
expired: 'Su cuenta ha expirado debido a inactividad. Por favor contacte al administrador de la aplicación.'
|
data/config/locales/fa.yml
CHANGED
data/config/locales/fr.yml
CHANGED
|
@@ -9,8 +9,8 @@ fr:
|
|
|
9
9
|
one: doit contenir au moins un chiffre
|
|
10
10
|
other: doit contenir au moins %{count} chiffres
|
|
11
11
|
lower:
|
|
12
|
-
one: doit contenir au moins une lettre
|
|
13
|
-
other: doit contenir au moins %{count} lettres
|
|
12
|
+
one: doit contenir au moins une lettre minuscule
|
|
13
|
+
other: doit contenir au moins %{count} lettres minuscules
|
|
14
14
|
symbol:
|
|
15
15
|
one: doit contenir au moins un signe de ponctuation
|
|
16
16
|
other: doit contenir au moins %{count} signes de ponctuation
|
|
@@ -22,9 +22,21 @@ fr:
|
|
|
22
22
|
invalid_security_question: La réponse à la question de sécurité est invalide
|
|
23
23
|
paranoid_verify:
|
|
24
24
|
code_required: Veuillez entrer le code fourni par notre équipe de support
|
|
25
|
+
paranoid_verification_code:
|
|
26
|
+
updated: Code de vérification accepté
|
|
27
|
+
show:
|
|
28
|
+
submit_verification_code: Soumettre le code de vérification
|
|
29
|
+
verification_code: Code de vérification
|
|
30
|
+
submit: Soumettre
|
|
25
31
|
password_expired:
|
|
26
32
|
updated: Votre nouveau mot de passe est enregistré
|
|
27
33
|
change_required: Votre mot de passe a expiré. Veuillez en choisir un autre
|
|
34
|
+
show:
|
|
35
|
+
renew_your_password: Renouveler votre mot de passe
|
|
36
|
+
current_password: Mot de passe actuel
|
|
37
|
+
new_password: Nouveau mot de passe
|
|
38
|
+
new_password_confirmation: Confirmer le nouveau mot de passe
|
|
39
|
+
change_my_password: Changer mon mot de passe
|
|
28
40
|
failure:
|
|
29
41
|
session_limited: Vos identifiants de connexion ont été utilisés dans un autre navigateur. Veuillez vous reconnecter pour continuer dans ce navigateur
|
|
30
42
|
expired: Votre compte a expiré pour cause d'inactivité. Veuillez contacter l'administrateur du site
|
data/config/locales/hi.yml
CHANGED
data/config/locales/it.yml
CHANGED
|
@@ -23,6 +23,7 @@ it:
|
|
|
23
23
|
paranoid_verify:
|
|
24
24
|
code_required: 'Inserisci il codice fornito dal nostro team di supporto'
|
|
25
25
|
paranoid_verification_code:
|
|
26
|
+
updated: Codice di verifica accettato
|
|
26
27
|
show:
|
|
27
28
|
submit_verification_code: Invia codice di verifica
|
|
28
29
|
verification_code: Codice di verifica
|
data/config/locales/ja.yml
CHANGED
|
@@ -22,9 +22,21 @@ ja:
|
|
|
22
22
|
invalid_security_question: 'セキュリティ質問に対する回答が不正です。'
|
|
23
23
|
paranoid_verify:
|
|
24
24
|
code_required: 'サポートチームに提供された認証コードを入力してください。'
|
|
25
|
+
paranoid_verification_code:
|
|
26
|
+
updated: 確認コードを受け入れました
|
|
27
|
+
show:
|
|
28
|
+
submit_verification_code: 確認コードを送信する
|
|
29
|
+
verification_code: 検証コード
|
|
30
|
+
submit: 参加する
|
|
25
31
|
password_expired:
|
|
26
32
|
updated: '新しいパスワードが保存されました。'
|
|
27
33
|
change_required: 'パスワードが期限切れです。パスワードを新しく設定してください。'
|
|
34
|
+
show:
|
|
35
|
+
renew_your_password: パスワードを更新する
|
|
36
|
+
current_password: 現在のパスワード
|
|
37
|
+
new_password: 新しいパスワード
|
|
38
|
+
new_password_confirmation: 新しいパスワードを確認
|
|
39
|
+
change_my_password: パスワードを変更する
|
|
28
40
|
failure:
|
|
29
41
|
session_limited: '他のブラウザでログインされました。このブラウザで続ける場合は、もう一度サインインしてください。'
|
|
30
42
|
expired: '活動がなかったため、あなたのアカウントは期限切れとなりました。サイト管理者に連絡してください。'
|
data/config/locales/nl.yml
CHANGED
data/config/locales/pt.yml
CHANGED
|
@@ -23,6 +23,7 @@ pt:
|
|
|
23
23
|
paranoid_verify:
|
|
24
24
|
code_required: 'Por favor entre o código que a equipe de suporte enviou'
|
|
25
25
|
paranoid_verification_code:
|
|
26
|
+
updated: Código de verificação aceito
|
|
26
27
|
show:
|
|
27
28
|
submit_verification_code: Enviar código de verificação
|
|
28
29
|
verification_code: Código de verificação
|
data/config/locales/ru.yml
CHANGED
|
@@ -31,6 +31,7 @@ ru:
|
|
|
31
31
|
paranoid_verify:
|
|
32
32
|
code_required: 'Пожалуйста введите код, полученный от нашей команды поддержки'
|
|
33
33
|
paranoid_verification_code:
|
|
34
|
+
updated: Код подтверждения принят
|
|
34
35
|
show:
|
|
35
36
|
submit_verification_code: Ввод кода подтверждения
|
|
36
37
|
verification_code: Код подверждения
|
data/config/locales/tr.yml
CHANGED
|
@@ -4,15 +4,39 @@ tr:
|
|
|
4
4
|
taken_in_past: "daha önce kullanıldı."
|
|
5
5
|
equal_to_current_password: "mevcut paroladan farklı olmalı."
|
|
6
6
|
equal_to_email: "e-postadan farklı olmalı."
|
|
7
|
-
|
|
7
|
+
password_complexity:
|
|
8
|
+
digit:
|
|
9
|
+
one: en az bir rakam içermelidir
|
|
10
|
+
other: en az %{count} basamak içermelidir
|
|
11
|
+
lower:
|
|
12
|
+
one: en az bir küçük harf içermelidir
|
|
13
|
+
other: en az %{count} küçük harf içermelidir
|
|
14
|
+
symbol:
|
|
15
|
+
one: en az bir noktalama işareti veya sembolü içermelidir
|
|
16
|
+
other: en az %{count} noktalama işareti veya sembolü içermelidir
|
|
17
|
+
upper:
|
|
18
|
+
one: en az bir büyük harf içermelidir
|
|
19
|
+
other: en az %{count} büyük harf içermelidir
|
|
8
20
|
devise:
|
|
9
21
|
invalid_captcha: "Captcha hatalı."
|
|
10
22
|
invalid_security_question: "Güvenlik sorusunun cevabı yanlış."
|
|
11
23
|
paranoid_verify:
|
|
12
24
|
code_required: "Destek ekibimizden aldığınız kodu girin."
|
|
25
|
+
paranoid_verification_code:
|
|
26
|
+
updated: Doğrulama kodu kabul edildi
|
|
27
|
+
show:
|
|
28
|
+
submit_verification_code: Doğrulama kodunu gönder
|
|
29
|
+
verification_code: Doğrulama kodu
|
|
30
|
+
submit: Gönder
|
|
13
31
|
password_expired:
|
|
14
32
|
updated: "Yeni parolanız kaydedildi."
|
|
15
33
|
change_required: "Parolanızın geçerlilik süresi dolmuş. Lütfen parolanızı yenileyin."
|
|
34
|
+
show:
|
|
35
|
+
renew_your_password: Şifrenizi yenileyin
|
|
36
|
+
current_password: Mevcut Şifre
|
|
37
|
+
new_password: Yeni Şifre
|
|
38
|
+
new_password_confirmation: Yeni şifreyi onayla
|
|
39
|
+
change_my_password: Şifremi Değiştir
|
|
16
40
|
failure:
|
|
17
41
|
session_limited: 'Hesabınıza başka bir tarayıcıdan giriş yapılmış. Lütfen devam etmek için yeniden giriş yapın.'
|
|
18
42
|
expired: 'Hesabınız aktif olarak kullanılmadığı için artık geçerli değil. Lütfen yönetici ile irtibata geçin.'
|
data/config/locales/uk.yml
CHANGED
|
@@ -31,6 +31,7 @@ uk:
|
|
|
31
31
|
paranoid_verify:
|
|
32
32
|
code_required: 'Введіть, будь ласка, код від нашої команди підтримки'
|
|
33
33
|
paranoid_verification_code:
|
|
34
|
+
updated: Код підтвердження прийнято
|
|
34
35
|
show:
|
|
35
36
|
submit_verification_code: Відправити код підтвердження
|
|
36
37
|
verification_code: Код підтвердження
|
data/config/locales/zh_CN.yml
CHANGED
data/config/locales/zh_TW.yml
CHANGED
|
@@ -29,8 +29,8 @@ module DeviseSecurity
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def valid_captcha_if_defined?(captcha)
|
|
32
|
-
defined?(verify_recaptcha) && verify_recaptcha ||
|
|
33
|
-
defined?(valid_captcha?) && valid_captcha?(captcha)
|
|
32
|
+
(defined?(verify_recaptcha) && verify_recaptcha) ||
|
|
33
|
+
(defined?(valid_captcha?) && valid_captcha?(captcha))
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def valid_security_question_answer?(resource, answer)
|
|
@@ -75,12 +75,18 @@ module DeviseSecurity
|
|
|
75
75
|
def handle_paranoid_verification
|
|
76
76
|
return if warden.nil?
|
|
77
77
|
|
|
78
|
-
if !devise_controller? &&
|
|
78
|
+
if !devise_controller? &&
|
|
79
|
+
!ignore_paranoid_verification_code? &&
|
|
80
|
+
!request.format.nil? &&
|
|
81
|
+
request.format.html?
|
|
79
82
|
Devise.mappings.keys.flatten.any? do |scope|
|
|
80
|
-
if signed_in?(scope) && warden.session(scope)['paranoid_verify']
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
if signed_in?(scope) && warden.session(scope)['paranoid_verify'] == true
|
|
84
|
+
if send(:"current_#{scope}").try(:need_paranoid_verification?)
|
|
85
|
+
store_location_for(scope, request.original_fullpath) if request.get?
|
|
86
|
+
redirect_for_paranoid_verification(scope)
|
|
87
|
+
else
|
|
88
|
+
warden.session(scope)['paranoid_verify'] = false
|
|
89
|
+
end
|
|
84
90
|
end
|
|
85
91
|
end
|
|
86
92
|
end
|
|
@@ -98,14 +104,16 @@ module DeviseSecurity
|
|
|
98
104
|
# path for change password
|
|
99
105
|
def change_password_required_path_for(resource_or_scope = nil)
|
|
100
106
|
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
|
101
|
-
|
|
102
|
-
send(
|
|
107
|
+
router_name = Devise.mappings[scope].router_name
|
|
108
|
+
context = router_name ? send(router_name) : _devise_route_context
|
|
109
|
+
context.send("#{scope}_password_expired_path")
|
|
103
110
|
end
|
|
104
111
|
|
|
105
112
|
def paranoid_verification_code_path_for(resource_or_scope = nil)
|
|
106
113
|
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
|
107
|
-
|
|
108
|
-
send(
|
|
114
|
+
router_name = Devise.mappings[scope].router_name
|
|
115
|
+
context = router_name ? send(router_name) : _devise_route_context
|
|
116
|
+
context.send("#{scope}_paranoid_verification_code_path")
|
|
109
117
|
end
|
|
110
118
|
|
|
111
119
|
protected
|
|
@@ -114,6 +122,10 @@ module DeviseSecurity
|
|
|
114
122
|
def ignore_password_expire?
|
|
115
123
|
false
|
|
116
124
|
end
|
|
125
|
+
|
|
126
|
+
def ignore_paranoid_verification_code?
|
|
127
|
+
false
|
|
128
|
+
end
|
|
117
129
|
end
|
|
118
130
|
end
|
|
119
131
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Updates the last_activity_at fields from the record. Only when the user is active
|
|
3
|
+
# Updates the last_activity_at fields from the record. Only when the user is active
|
|
4
4
|
# for authentication and authenticated.
|
|
5
|
-
# An expiry of the account is only checked on sign in OR on manually setting the
|
|
5
|
+
# An expiry of the account is only checked on sign in OR on manually setting the
|
|
6
6
|
# expired_at to the past (see Devise::Models::Expirable for this)
|
|
7
7
|
Warden::Manager.after_set_user do |record, warden, options|
|
|
8
|
-
if record && record.respond_to?(:active_for_authentication?) && record.active_for_authentication? &&
|
|
8
|
+
if record && record.respond_to?(:active_for_authentication?) && record.active_for_authentication? &&
|
|
9
9
|
warden.authenticated?(options[:scope]) && record.respond_to?(:update_last_activity!)
|
|
10
10
|
record.update_last_activity!
|
|
11
11
|
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
Warden::Manager.after_set_user do |record, warden, options|
|
|
4
|
-
if record.respond_to?(:need_paranoid_verification?)
|
|
5
|
-
warden.session(options[:scope])['paranoid_verify'] = record.need_paranoid_verification?
|
|
6
|
-
end
|
|
4
|
+
warden.session(options[:scope])['paranoid_verify'] = record.need_paranoid_verification? if record.respond_to?(:need_paranoid_verification?)
|
|
7
5
|
end
|
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
# @note This happens after
|
|
4
4
|
# {DeviseSecurity::Controller::Helpers#handle_password_change}
|
|
5
5
|
Warden::Manager.after_authentication do |record, warden, options|
|
|
6
|
-
if record.respond_to?(:need_change_password?)
|
|
7
|
-
warden.session(options[:scope])['password_expired'] = record.need_change_password?
|
|
8
|
-
end
|
|
6
|
+
warden.session(options[:scope])['password_expired'] = record.need_change_password? if record.respond_to?(:need_change_password?)
|
|
9
7
|
end
|