Class: CommonPassword::List
- Inherits:
-
Object
- Object
- CommonPassword::List
- Defined in:
- lib/common_password/list.rb
Class Method Summary collapse
-
.get ⇒ Object
Returns a list of the #Devise.password_matches most common passwords.
Class Method Details
.get ⇒ Object
Returns a list of the #Devise.password_matches most common passwords.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/common_password/list.rb', line 4 def self.get passwords_file = File.join(File.dirname(__FILE__), "passwords.txt") passwords = [] File.open(passwords_file, 'r') do |file| file.each { |password| passwords << password.chomp.downcase } end passwords.select! { |password| ::Devise.password_length.include? password.length } passwords[0..::Devise.password_matches - 1] end |