From 6232717898173885fafe1a9884543e627b79b72f Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 20 May 2016 17:45:40 +0800 Subject: [PATCH] Fix last version yellow color missing bug. version 0.4.4 --- CHANGELOG.md | 2 +- Gemfile.lock | 2 +- lib/rucaptcha/captcha.rb | 9 ++++++--- lib/rucaptcha/version.rb | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b9391..dfe7472 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -0.4.3 +0.4.4 - Remove deprecated `width`, `height` config. - Delete session key after verify (#23). diff --git a/Gemfile.lock b/Gemfile.lock index 7067620..6fa101a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rucaptcha (0.4.3) + rucaptcha (0.4.4) posix-spawn (>= 0.3.0) GEM diff --git a/lib/rucaptcha/captcha.rb b/lib/rucaptcha/captcha.rb index 59b8b1a..2b2cca9 100644 --- a/lib/rucaptcha/captcha.rb +++ b/lib/rucaptcha/captcha.rb @@ -5,9 +5,8 @@ module RuCaptcha class << self def random_color if RuCaptcha.config.style == :colorful - color_seed = (rand(150) + 40).to_s(8) - color = [0.to_s(8), 0.to_s(8), 0.to_s(8)] - color[rand(3)] = color_seed + color = [random_color_seed, random_color_seed, random_color_seed] + color[rand(3)] = 0.to_s(8) color else color_seed = rand(50).to_s(8) @@ -15,6 +14,10 @@ module RuCaptcha end end + def random_color_seed + (rand(150) + 10).to_s(8) + end + def random_chars chars = SecureRandom.hex(RuCaptcha.config.len / 2).downcase chars.gsub!(/[0ol1]/i, (rand(8) + 2).to_s) diff --git a/lib/rucaptcha/version.rb b/lib/rucaptcha/version.rb index 77ea63e..bd2ba7e 100644 --- a/lib/rucaptcha/version.rb +++ b/lib/rucaptcha/version.rb @@ -1,3 +1,3 @@ module RuCaptcha - VERSION = '0.4.3' + VERSION = '0.4.4' end