Fix last version yellow color missing bug. version 0.4.4

This commit is contained in:
Jason Lee 2016-05-20 17:45:40 +08:00
parent d42bf4c8e2
commit 6232717898
4 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
0.4.3 0.4.4
- Remove deprecated `width`, `height` config. - Remove deprecated `width`, `height` config.
- Delete session key after verify (#23). - Delete session key after verify (#23).

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
rucaptcha (0.4.3) rucaptcha (0.4.4)
posix-spawn (>= 0.3.0) posix-spawn (>= 0.3.0)
GEM GEM

View File

@ -5,9 +5,8 @@ module RuCaptcha
class << self class << self
def random_color def random_color
if RuCaptcha.config.style == :colorful if RuCaptcha.config.style == :colorful
color_seed = (rand(150) + 40).to_s(8) color = [random_color_seed, random_color_seed, random_color_seed]
color = [0.to_s(8), 0.to_s(8), 0.to_s(8)] color[rand(3)] = 0.to_s(8)
color[rand(3)] = color_seed
color color
else else
color_seed = rand(50).to_s(8) color_seed = rand(50).to_s(8)
@ -15,6 +14,10 @@ module RuCaptcha
end end
end end
def random_color_seed
(rand(150) + 10).to_s(8)
end
def random_chars def random_chars
chars = SecureRandom.hex(RuCaptcha.config.len / 2).downcase chars = SecureRandom.hex(RuCaptcha.config.len / 2).downcase
chars.gsub!(/[0ol1]/i, (rand(8) + 2).to_s) chars.gsub!(/[0ol1]/i, (rand(8) + 2).to_s)

View File

@ -1,3 +1,3 @@
module RuCaptcha module RuCaptcha
VERSION = '0.4.3' VERSION = '0.4.4'
end end