diff --git a/config/initializers/zxcvbn.rb b/config/initializers/zxcvbn.rb new file mode 100644 index 000000000..bf725f993 --- /dev/null +++ b/config/initializers/zxcvbn.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +path = Rails.root.join("config/words_fr_frequency_list.txt") +lines = path.readlines.map(&:strip) +filename = File.basename(path, ".*") + +new_ranked_dictionary = Hash[filename, Zxcvbn::Matching.build_ranked_dict(lines)] +# Zxcvbn::Matching::RANKED_DICTIONARIES.merge! new_ranked_dictionary +Zxcvbn::Matching::RANKED_DICTIONARIES = new_ranked_dictionary diff --git a/config/words_fr_frequency_list.txt b/config/words_fr_frequency_list.txt new file mode 100644 index 000000000..fa53d2086 --- /dev/null +++ b/config/words_fr_frequency_list.txt @@ -0,0 +1,4 @@ +password +00000000 +test +azerty