Use Time.now.nsec
for text field id
The text field id has to be unique for when you want two different captchas on the same page.
This commit is contained in:
parent
d07827595a
commit
04e016c188
@ -44,7 +44,7 @@ module ReallySimpleCaptcha::Captcha
|
|||||||
|
|
||||||
content_tag :div, class: 'plain_captcha' do
|
content_tag :div, class: 'plain_captcha' do
|
||||||
html = image_tag "data:image/gif;base64,#{image}", alt: "Captcha"
|
html = image_tag "data:image/gif;base64,#{image}", alt: "Captcha"
|
||||||
html.concat text_field_tag PlainCaptcha.field_name, nil, required: 'required', autocomplete: 'off'
|
html.concat text_field_tag PlainCaptcha.field_name, nil, id: "reverse_captcha_#{Time.now.nsec}", required: 'required', autocomplete: 'off'
|
||||||
|
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,7 @@ module ReallySimpleCaptcha::Captcha
|
|||||||
|
|
||||||
module ViewHelpers
|
module ViewHelpers
|
||||||
def reverse_captcha_tag
|
def reverse_captcha_tag
|
||||||
content_tag :div, text_field_tag(ReverseCaptcha.field_name), class: 'reverse_captcha', style: 'display: none'
|
content_tag :div, text_field_tag(ReverseCaptcha.field_name, nil, id: "reverse_captcha_#{Time.now.nsec}"), class: 'reverse_captcha', style: 'display: none'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user