Module: VisualCaptcha::ViewHelper

Defined in:
lib/visualcaptcha/view.rb

Instance Method Summary collapse

Instance Method Details

#show_visual_captcha(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/visualcaptcha/view.rb', line 4

def show_visual_captcha(options = {})
  options = sanitize_options(options)

  #key = visual_captcha_key('captcha')

  number = options[:type] == "type-0" ? 5 : 4
  captcha = VisualCaptcha::Captcha.new(number)
  challenge = captcha.build

  session[:captcha] = challenge

  render :partial => 'visual_captcha/visual_captcha', :locals => { :captcha_options =>  options, :challenge => challenge }
end