Authlogic: How to block certain names and email addresses?

259 Views Asked by At

Using Authlogic, what's the proper way to ban certain usernames and domains (for email addresses)? The list if usernames and domains 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).

1

There are 1 best solutions below

2
On BEST ANSWER

See Active Record validates_exclusion_of.

class User
  validates_exclusion_of :username, :in => %w( admin moderator )
end