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.
- Host: GitHub
- URL: https://github.com/fuseraft/recaptcha_check
- Owner: fuseraft
- Created: 2023-02-19T01:37:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T16:46:34.000Z (about 3 years ago)
- Last Synced: 2025-03-27T02:24:22.451Z (about 1 year ago)
- Language: Ruby
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```