New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yinxiangma

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yinxiangma

  • 0.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= YinXiangMa CAPTCHA

Author:: SouthWolf Copyright:: Copyright (c) 2011 SouthWolf, Yinxiangma Inc. License:: {MIT}[http://creativecommons.org/licenses/MIT/] Info:: http://github.com/southwolf/yinxiangma Git:: http://github.com/southwolf/yinxiangma/tree/master Bugs:: http://github.com/southwolf/yinxiangma/issues

This plugin adds helpers for the {YinXiangMa CAPTCHA API}[http://www.yinxiangma.com]. In your views you can use the +yinxiangma_tags+ method to embed the needed javascript, and you can validate in your controllers with +yinxiangma_valid+.

Beforehand you need to configure YinXiangMa with your custom publisher key. You may find detailed examples below. Exceptions will be raised if you call these methods and the keys can't be found.

== About this gem

This gem tries to introduces a more convenient way to configure YinXiangMa's settings. The structure & style are inspired by {reCAPTCHA gem}[http://ambethia.com/recaptcha]

== Rails Installation

YinXiangMa for Rails, add this to your Gemfile:

gem "yinxiangma", :require => "yinxiangma/rails"

Or, it can be installed as a gem:

config.gem "yinxiangma", :lib => "yinxiangma/rails"

Or, as a standard rails plugin:

script/plugin install git://github.com/southwolf/yinxiangma.git

== Setting up your API Keys

There are multiple ways to setup your YinXiangMa API key once you {obtain}[http://www.yinxiangma.com] one.

=== YinXiangMa.configure

You may use the block style configuration. The following code could be placed into a +config/initializers/yinxiangma.rb+ when used in a Rails project.

Yinxiangma.configure do |config| config.publisher_key = 'cb9d0fe8dabdea89019d845be3059973' config.mode ='live' end

This way, you may also set additional options to fit YinXiangMa into your deployment environment.

=== Shell environment

Or, you can keep your keys out of your code base by exporting the following environment variables. You might do this in the .profile/rc, or equivalent for the user running your application:

export YINXIANGMA_PUBLISHER_KEY = 'cb9d0fe8dabdea89019d845be3059973'

=== Per call

You can also pass in your keys as options at runtime, for example:

yinxiangma_tags :publisher_key => 'cb9d0fe8dabdea89019d845be3059973'

This option might be useful, if the same code base is used for multiple YinXiangMa setups.

== To use 'YinXiangMa'

Add +yinxiangma_tags+ to each form you want to protect.

And, add +yinxiangma_valid+ logic to each form action that you've protected.

=== +yinxiangma_tags+

This method generate HTML tag including YinXiangMa widget.

=== +yinxiangma_valid+

This method returns +true+ or +false+ after processing the parameters from the YinXiangMa widget.

== TODO

  • Validation Error handlings
  • Better documentation
  • Switch back to local CAPTCHA or reCAPTHA when YinXiangMa is unavailable

= 印象码 动态验证码

{印象码}[http://www.yinxiangma.com]是目前中国国内推出的第一款视频广告验证码云服务平台,不仅提供了安全的基于云计算的视频验证码服务,为网站提供了良好的验证码用户体验,并且提出了新一代的基于用户反馈的广告计费商业模式概念。

本gem提供了Rails下的印象码功能,配置简单。

首先请注册{印象码}[http://www.yinxiangma.com]服务,获取API key 建立+config/initializers/yinxiangma.rb+ 内容如下(请将publisher_key替换成您的key)

Yinxiangma.configure do |config| config.publisher_key = 'cb9d0fe8dabdea89019d845be3059973' config.mode ='live' end

在Gemfile添加 gem "yinxiangma", :require => "yinxiangma/rails"

建立

在View中插入<%= yinxiangma_tags %>, 在View中需要进行验证处插入yinxiangma_valid() 即可

FAQs

Package last updated on 05 Jan 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc