Recaptcha (or other captchas)

Does anyone have any suggestions for a best practice implementation of
Recaptcha (or other captchas - if you recommend going another route, I’m
all ears)? I’ve found the recaptcha gem and a plugin but I don’t know
which is the best implementation, and I haven’t found a thorough
tutorial plus example code for either.

Thanks

Neil C. wrote:

Does anyone have any suggestions for a best practice implementation of
Recaptcha (or other captchas - if you recommend going another route, I’m
all ears)? I’ve found the recaptcha gem and a plugin but I don’t know
which is the best implementation, and I haven’t found a thorough
tutorial plus example code for either.

Thanks

No ideas?

I have implemented Recaptcha on the registration page of this site:
http://www.satechevents.co.za/account/register

I am using the gem here:
http://www.loonsoft.com/recaptcha/

Schalk

Schalk N. wrote:

I have implemented Recaptcha on the registration page of this site:
http://www.satechevents.co.za/account/register

I am using the gem here:
http://www.loonsoft.com/recaptcha/

Schalk

Thanks, Schalk. I liked the idea of the plugin (I prefer plugins because
I can jump right in to the code on which the app is dependent) but the
gem seemed easy enough. However, I’ve followed the instructions and I’m
stuck on this;

/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:278:in
`load_missing_constant’: uninitialized constant RecaptchaClient
(NameError)

How are you including the gem? I created an initializer
(recaptcha_credentials.rb) with this inside;

RecaptchaClient.new(:rcc_pub=>‘my_code’, :rcc_priv=>‘my_code’)

…because I thought it was best to keep the environment.rb free of
these things. I’ve tried putting it in the environment.rb, but that just
breaks, too (same error). Where am I going wrong?! Mongrel loads if I
don’t include the RecaptchaClient.new.

Also, I saw this when I was installing the gem;

WARNING: RubyGems 1.2+ index not found for:
http://www.loonsoft.com/recaptcha/pkg/

RubyGems will revert to legacy indexes degrading performance.
Successfully installed recaptcha-0.1.49
1 gem installed
Installing ri documentation for recaptcha-0.1.49…
Installing RDoc documentation for recaptcha-0.1.49…

Cheers

On 3 Oct 2008, at 14:15, Neil C. wrote:

Thanks, Schalk. I liked the idea of the plugin (I prefer plugins
because
I can jump right in to the code on which the app is dependent) but the
gem seemed easy enough. However, I’ve followed the instructions and
I’m
stuck on this;

I used that gem once. I ended up requiring the gem from an initializer
and reopening this class:

module ReCaptcha
module AppHelper
RCC_PUB = ‘your key here’
RCC_PRIV = ‘your key here’
end
end

which seemed to work. I vaguely recall the setup instructions being a
bit out of date

Fred

Frederick C. wrote:

On 3 Oct 2008, at 14:15, Neil C. wrote:

Thanks, Schalk. I liked the idea of the plugin (I prefer plugins
because
I can jump right in to the code on which the app is dependent) but the
gem seemed easy enough. However, I’ve followed the instructions and
I’m
stuck on this;

I used that gem once. I ended up requiring the gem from an initializer
and reopening this class:

module ReCaptcha
module AppHelper
RCC_PUB = ‘your key here’
RCC_PRIV = ‘your key here’
end
end

which seemed to work. I vaguely recall the setup instructions being a
bit out of date

Fred

Thanks Fred. Since the last post I’ve moved to the plugin, however, I’m
struggling with that one, too. It should be insanely simple; I just need
to set the public and private keys as variables in the environment.rb
(or an initializer, if applicable) - but I just can’t get it to work;

http://pastie.org/284245

I can hack the plugin to use the keys as strings without using variables
(means removing an ‘unless’ condition, too), but that defeats the point
of a well test plugin. Can you see what I’m doing wrong here?

On 3 Oct 2008, at 15:21, Neil C. wrote:

stuck on this;
end
to set the public and private keys as variables in the environment.rb
(or an initializer, if applicable) - but I just can’t get it to work;

http://pastie.org/284245

If you’re going that way you need to set ENV[‘RECAPTCHA_PUBLIC_KEY’],
which is not the same thing as RECAPTCHA_PUBLIC_KEY

Fred

And should I be using any specs for recaptcha? I struggled to find much
through a Googling…

Frederick C. wrote:

On 3 Oct 2008, at 15:21, Neil C. wrote:

stuck on this;
end
to set the public and private keys as variables in the environment.rb
(or an initializer, if applicable) - but I just can’t get it to work;

http://pastie.org/284245

If you’re going that way you need to set ENV[‘RECAPTCHA_PUBLIC_KEY’],
which is not the same thing as RECAPTCHA_PUBLIC_KEY

Fred

Thank you, this works like a charm;

ENV[‘RECAPTCHA_PUBLIC_KEY’] = ‘some_key’;

The best is always hard to define depending on personal opinion which
is extremely variant from one to another. Choose something you
yourself feels comfortable with and then go through the documentation
and install. I’ve seen that ReCAPTCHA can be used with Ruby on Rails
and trying “Recaptcha Ruby R.” into google got me this result:
Dead Programmer Society: Recaptcha On Rails
which seems fairly detailed.

Ryan B.
Freelancer

Ryan B. wrote:

The best is always hard to define depending on personal opinion which
is extremely variant from one to another. Choose something you
yourself feels comfortable with and then go through the documentation
and install. I’ve seen that ReCAPTCHA can be used with Ruby on Rails
and trying “Recaptcha Ruby R.” into google got me this result:
Dead Programmer Society: Recaptcha On Rails
which seems fairly detailed.

Ryan B.
Freelancer
http://frozenplague.net

Thanks Ryan. That tutorial looks handy. I managed to implement the
plugin in the same way that hte tutorial describes (if only I had had it
at the time). I’ve seen very little on the spec/test front on
integrating recaptcha. Maybe it’s not so important, then?