No commit activity in last 3 years
No release in over 3 years
A Sinatra module to seamlessly integrate OpenCaptcha to Sinatra applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.6.7
~> 1.3.2
~> 2.1.2
 Project Readme

Sinatra-OpenCaptcha

A Sinatra extension to seamlessly integrate OpenCaptcha to Sinatra applications.

See http://www.opencaptcha.com for more information about OpenCaptcha

Installation

gem install sinatra-opencaptcha

Usage example

require 'sinatra'
require 'sinatra/opencaptcha'

get '/' do
  erb :index
end

post '/' do
  if open_captcha_valid?
    "Welcome, dear #{params[:name]}!"
  else
    "Go away, bloody spamming machine!"
  end
end

__END__

@@ index
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
  </head>
  <body>
    <form action="/" method="post">
      <p><label for=\"name\">My name: </label><input type="text" id="name" name="name"/></p>
      <%= open_captcha :answer_input_label => 'What do you read?: ', :answer_input_class => 'text' %>
      <p><input type="submit" value="Submit"/></p>
    </form>
  </body>
</html>