Add configuration parameter defining password min length through env variable PASSWORD_MIN_LENGTH (#7657)

This commit is contained in:
Alex Kriuchykhin 2024-06-21 10:51:20 +02:00 committed by GitHub
parent 3cb610280d
commit 89ded1f0f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,7 +192,10 @@ Devise.setup do |config|
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 8..72
password_min_length = ENV['PASSWORD_MIN_LENGTH'].to_i
password_max_length = 72
password_min_length = 8 unless password_min_length.positive? && password_min_length < password_max_length
config.password_length = password_min_length..password_max_length
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly