From 014bfc05120f55317e65393df27e98ca780bb99f Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 2 May 2014 12:01:21 -0400 Subject: [PATCH] Use 10k most common passwords instead of 5k --- config/locales/server.en.yml | 4 ++-- lib/common_passwords/common_passwords.rb | 2 +- spec/components/common_passwords/common_passwords_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index f1c18600b..e2132ad27 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -208,7 +208,7 @@ en: user: attributes: password: - common: "is one of the 5000 most common passwords. Please use a more secure password." + common: "is one of the 10000 most common passwords. Please use a more secure password." ip_address: signup_not_allowed: "Signup is not allowed from this account." @@ -703,7 +703,7 @@ en: min_username_length: "Minimum username length. (Does not apply if global nickname uniqueness is forced)" min_password_length: "Minimum password length." - block_common_passwords: "Don't allow passwords that are in the 5000 most common passwords." + block_common_passwords: "Don't allow passwords that are in the 10000 most common passwords." enable_sso: "Enable single sign on via an external site" sso_url: "URL of single sign on endpoint" diff --git a/lib/common_passwords/common_passwords.rb b/lib/common_passwords/common_passwords.rb index d1f342919..9bd9f025a 100644 --- a/lib/common_passwords/common_passwords.rb +++ b/lib/common_passwords/common_passwords.rb @@ -41,7 +41,7 @@ class CommonPasswords def self.load_passwords passwords = File.readlines(PASSWORD_FILE) - passwords[0,5000].map!(&:chomp).each do |pwd| + passwords.map!(&:chomp).each do |pwd| # slower, but a tad more compatible redis.sadd LIST_KEY, pwd end diff --git a/spec/components/common_passwords/common_passwords_spec.rb b/spec/components/common_passwords/common_passwords_spec.rb index fc7e101c8..a10020058 100644 --- a/spec/components/common_passwords/common_passwords_spec.rb +++ b/spec/components/common_passwords/common_passwords_spec.rb @@ -51,7 +51,7 @@ describe CommonPasswords do it "doesn't load the passwords file if redis has it" do mock_redis = mock("redis") mock_redis.stubs(:exists).returns(true) - mock_redis.stubs(:scard).returns(5000) + mock_redis.stubs(:scard).returns(10000) described_class.stubs(:redis).returns(mock_redis) described_class.expects(:load_passwords).never list = described_class.password_list