Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/controllers/simple_captcha_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ class SimpleCaptchaController < ActionController::Metal
# GET /simple_captcha
def show
unless params[:id].blank?
send_file(
generate_simple_captcha_image(params[:id]),
image = File.read generate_simple_captcha_image(params[:id])
send_data(
image,
:type => 'image/jpeg',
:disposition => 'inline',
:filename => 'simple_captcha.jpg')
Expand Down
4 changes: 3 additions & 1 deletion lib/simple_captcha/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def template
end

def simple_captcha_field(options={})
text_field(:captcha, :value => '', :autocomplete => 'off') +
text_field_options = {:value => '', :autocomplete => 'off'}
text_field_options[:size] = options[:size] unless options[:size].nil?
text_field(:captcha, text_field_options) +
hidden_field(:captcha_key, {:value => options[:field_value]})
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/simple_captcha/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Tempfile < ::Tempfile
# Replaces Tempfile's +make_tmpname+ with one that honors file extensions.
def make_tmpname(basename, n)
extension = File.extname(basename)
n ||= 0
sprintf("%s,%d,%d%s", File.basename(basename, extension), $$, n, extension)
end
end
Expand Down