An open API service indexing awesome lists of open source software.

https://github.com/fuseraft/recaptcha_check

A simple interface for verifying Google reCAPTCHA responses.
https://github.com/fuseraft/recaptcha_check

Last synced: about 1 year ago
JSON representation

A simple interface for verifying Google reCAPTCHA responses.

Awesome Lists containing this project

README

          

# recaptcha_check (reCAPTCHA verification)
A simple interface for verifying Google reCAPTCHA responses.

You can find the gem here: [RubyGems.org](https://rubygems.org/gems/recaptcha_check)

# Installation
```
gem install recaptcha_check
```

# Methods
`RecaptchaCheck#register`: sets the reCAPTCHA private key to be used during verification.

`RecaptchaCheck#verify`: returns `true` if the reCAPTCHA response passes verification.

# Configuration
You must call `RecaptchaCheck#register` once early in your application to set the reCAPTCHA private key before using `RecaptchaCheck#verify` in other parts of your application.
```Ruby
RecaptchaCheck.register ENV['var_containing_your_reCAPTCHA_PrivateKey']
```

# Usage in Sinatra app
```Ruby
post '/contact' do
require 'recaptcha_check'

if RecaptchaCheck.verify(params)
# mailer.send params
redirect '/contact/sent'
else
redirect back
end
end
```