min_length.rb 414 B

123456789101112131415161718
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class PasswordPolicy
  3. class MinLength < PasswordPolicy::Backend
  4. def valid?
  5. Setting.get('password_min_size').to_i <= @password.length
  6. end
  7. def error
  8. [__('Invalid password, it must be at least %s characters long!'), Setting.get('password_min_size')]
  9. end
  10. def self.applicable?
  11. true
  12. end
  13. end
  14. end