Coder Social home page Coder Social logo

recaptcha's Introduction

ReCAPTCHA

Author

Jason L Perry (ambethia.com)

Copyright

Copyright © 2007 Jason L Perry

License

MIT

RDOC

ambethia.com/recaptcha/

Git

github.com/ambethia/recaptcha/tree/master

Bugs

ambethia.lighthouseapp.com/projects/11072-recaptcha/overview

This plugin adds helpers for the ReCAPTCHA API (recaptcha.net/). In your views you can use the recaptcha_tags method to embed the needed javascript, and you can validate in your controllers with verify_recaptcha.

You’ll want to add your public and private API keys in the environment variables RECAPTCHA_PUBLIC_KEY and RECAPTCHA_PRIVATE_KEY, respectively. You could also specify them in config/environment.rb if you are so inclined. Exceptions will be raised if you call these methods and the keys can’t be found.

recaptcha_tags

Some of the options available:

:ssl

Uses secure http for captcha widget (default false)

:noscript

Include <noscript> content (default true)

:display

Takes a hash containing the theme and tabindex options per the API. (default nil)

:public_key

Your public API key, takes precedence over the ENV variable (default nil).

:error

Override the error in session[:recaptcha_error] (default nil).

verify_recaptcha

This method returns true or false after processing the parameters from the ReCAPTCHA widget. Why isn’t this a model validation? Because that violates MVC. Use can use it like this, or how ever you like. Passing in the ActiveRecord object is optional, if you do–and the captcha fails to verify–an error will be added to the object for you to use.

respond_to do |format|
  if verify_recaptcha(@post) && @post.save
    # ...
  else
    # ...
  end
end

TODO

  • Remove Rails/ActionController dependencies

  • Framework agnostic

  • Add some helpers to use in before_filter and what not

  • Better documentation

recaptcha's People

Contributors

andrew avatar

Stargazers

Angus H. avatar William Melody avatar

Watchers

William Melody avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.