Replaced ReCaptcha with Akismet
Monday, 05 January 2009
Spent a little bit of time over the weekend replacing the ReCaptcha anti-spamming filter I was using in Matilda with Akismet mainly because it's a little less in-your-face to the user.
Don't get me wrong, ReCaptcha was good and stopped comment spam 100% in it's tracks but the comments I got back and what I felt about it was that it was a bottleneck in the UI; and it needed to go simply to be easier for the poster.
So some quick research on the subject produced two possibilities, build my own Akismet handler or pop in JFrench's RAkismet plugin, the later being the quicker idea.
All it requires you to have is a Akismet key that can be obtained freely thru a Wordpress.com account. Put that along with you're site's URL into your rakismet.rb file, make the changes to your relevant models & controller and you're away.
So install with;
script/plugin install git://github.com/jfrench/rakismet.git
Next add it to the model's that you'll need akismet against and tell it what fields you've got for it to filter with (in case it's spam);
class Comment < ActiveRecord::Base
has_rakismet :author => :username,
:author_url => :url,
:author_email => :email,
:user_ip => :ip_address,
:user_agent => :user_agent,
:referrer => :referrer
Add the handlers only for the controller actions you need;
class BlogController < ApplicationController
has_rakismet :only => [:post_comment, :post_message]
This will give you a simple .spam? method you can then call on you're new model object to check whether it's spam. On top of this add to your model extra fields to store info about the user's ip, agent and referrer which you can feed into Akismet and it's filter above to improve your chances of filtering out the bad.
request.env['REMOTE_HOST'] #ip_address
request.env['USER_AGENT'] #user_agent
request.env['HTTP_REFERER'] #referrer
Put all the changes into my Matilda CMS's GitHub repository, do need to add some buttons to clear spam quickly and mark what's ham; but all in time.
Comments
-
Reverse captchas work well. And even better if you also use javascript to insert the form.






