This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
heavysixer (author)
Thu May 29 11:50:16 -0700 2008
commit 58ab5de0d2b84503c62bc02e29a8b9ee2f431915
tree ec0b4f3f3e15954e2a1a247c12da828b6cd7de41
parent 55e9e2b15d6aa9c084fc3d89eeadecd11e564189
tree ec0b4f3f3e15954e2a1a247c12da828b6cd7de41
parent 55e9e2b15d6aa9c084fc3d89eeadecd11e564189
README
= NameNanny
I needed functionality to encourage user’s to be on their best behavior when they choosing a username or filling out a fo
rm. Bad behavior can come in many forms but specifically, I wanted to prevent people from registering usernames like
“administrator”, “root”, “abuse”,”support” etc. I also didn’t want people to pick names like “whore” or even “h
oar”,”h0ar”,”wh0r3” (you get the picture). It occurred to me that others would like this functionality too, so I created
the name_nanny plug-in which can be employed in a couple of ways.
== Example usage
In the model you can use:
validates_wholesomeness_of :login
This will check the login against values in two text files in the plug-in directory “badwords.txt”, and “res
trictedwords.txt”. By default a match returns an non-descript error like “this username is already taken”. I chose a gene
ralized error to dissuade users from trying to hack around the filter and find a word i missed.
If you are filtering the body of text you may want to allow words like “administrator” in the body of the document. Ther
efore namenanny has a second method called “bleeptext”, which you can use thusly:
def before_save
%w(description, title, author, tags).each do |column|
if self[column.to_sym]
self[column.to_sym] = bleep_text(self[column.to_sym])
end
end
end
A sample output might look like this:
p = Post.new
p.description = "Step two: put your dick in a box."
p.save
puts p.description = "Step two: put your bleeep in a box."
You can also replace the bleeptext method with a smurftext method, which produces an equally hilarious: “Step two: put yo
ur smurf in a box.”
== Authors, credits, contact
Authors:: Mark Daggett
Original announcement:: http://locusfoc.us/2007/2/13/name-nanny-plugin









