Authlogic: How to block certain names and email addresses?
Using Authlogic, what's the proper way to ban certain usernames and domains (for email addresses)? The list if usernames and do开发者_开发技巧mains to block would be updated on an ongoing basis.
For instance, I don't want anyone to register with the username "admin" or "moderator" and I there are a slew of domain names I'd want to block from registering (for spam purposes).
See Active Record validates_exclusion_of.
class User
validates_exclusion_of :username, :in => %w( admin moderator )
end
精彩评论