Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 927 Bytes

Backup.md

File metadata and controls

34 lines (27 loc) · 927 Bytes

recaptcha_check (reCAPTCHA verification)

A simple interface for verifying Google reCAPTCHA responses.

You can find the gem here: RubyGems.org

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.

RecaptchaCheck.register 'your_reCAPTCHA_PrivateKey'

Example usage in a Sinatra app

post '/contact' do
    require 'recaptcha_check'

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