From aa577f11fd5cb736c4904e47ba88c9ebb08e974a Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 15 Jan 2014 12:38:59 +1100 Subject: [PATCH] BUGFIX: use a more widely compatible version of sadd --- lib/common_passwords/common_passwords.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/common_passwords/common_passwords.rb b/lib/common_passwords/common_passwords.rb index e2f9b3e600e..d1f34291990 100644 --- a/lib/common_passwords/common_passwords.rb +++ b/lib/common_passwords/common_passwords.rb @@ -41,7 +41,10 @@ class CommonPasswords def self.load_passwords passwords = File.readlines(PASSWORD_FILE) - redis.sadd LIST_KEY, passwords[0,5000].map!(&:chomp) + passwords[0,5000].map!(&:chomp).each do |pwd| + # slower, but a tad more compatible + redis.sadd LIST_KEY, pwd + end rescue Errno::ENOENT # tolerate this so we don't block signups Rails.logger.error "Common passwords file #{PASSWORD_FILE} is not found! Common password checking is skipped."