Skip to content

Commit

Permalink
BUGFIX: use a more widely compatible version of sadd
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jan 15, 2014
1 parent 7122fe0 commit aa577f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/common_passwords/common_passwords.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def self.redis

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."
Expand Down

0 comments on commit aa577f1

Please sign in to comment.