Module: Rack::Captchachacha::Helpers
- Defined in:
- lib/rack/captchachacha/helpers.rb
Instance Method Summary collapse
- #captcha_answer_tag ⇒ Object
- #captcha_image_tag ⇒ Object
- #captcha_session ⇒ Object
- #captcha_valid? ⇒ Boolean
Instance Method Details
#captcha_answer_tag ⇒ Object
22 23 24 |
# File 'lib/rack/captchachacha/helpers.rb', line 22 def captcha_answer_tag %Q!<input id="captcha_answer" name="captcha_answer" type="text" size="6"/>! end |
#captcha_image_tag ⇒ Object
27 28 29 |
# File 'lib/rack/captchachacha/helpers.rb', line 27 def captcha_image_tag %Q!<input id="captcha_session" name="captcha_session" type="hidden" value="#{captcha_session}"/><img id="captcha_image" src="http://captchator.com/captcha/image/#{captcha_session}"/>! end |
#captcha_session ⇒ Object
17 18 19 |
# File 'lib/rack/captchachacha/helpers.rb', line 17 def captcha_session @captcha_session ||= SecureRandom.random_number.to_s[2..-1] end |
#captcha_valid? ⇒ Boolean
12 13 14 |
# File 'lib/rack/captchachacha/helpers.rb', line 12 def captcha_valid? request.env['X-Captcha-Valid'] end |