20200522125253_issue_2943_add_setting_enforce_special_character.rb 964 B

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue2943AddSettingEnforceSpecialCharacter < ActiveRecord::Migration[5.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Setting.create_if_not_exists(
  7. title: 'Special character required',
  8. name: 'password_need_special_character',
  9. area: 'Security::Password',
  10. description: 'Password needs to contain at least one special character.',
  11. options: {
  12. form: [
  13. {
  14. display: 'Needed',
  15. null: true,
  16. name: 'password_need_special_character',
  17. tag: 'select',
  18. options: {
  19. 1 => 'yes',
  20. 0 => 'no',
  21. },
  22. },
  23. ],
  24. },
  25. state: 0,
  26. preferences: {
  27. permission: ['admin.security'],
  28. },
  29. frontend: false
  30. )
  31. end
  32. end