chore: attempt to inject our french dictionnary to new zxcvbn lib
Co-Authored-By: Lisa Durand <lisa.c.durand@gmail.com>
This commit is contained in:
parent
030bfa6651
commit
3a3993f2e1
2 changed files with 13 additions and 0 deletions
9
config/initializers/zxcvbn.rb
Normal file
9
config/initializers/zxcvbn.rb
Normal file
|
@ -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
|
4
config/words_fr_frequency_list.txt
Normal file
4
config/words_fr_frequency_list.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
password
|
||||||
|
00000000
|
||||||
|
test
|
||||||
|
azerty
|
Loading…
Reference in a new issue