开发者

Authlogic: How to block certain names and email addresses?

开发者 https://www.devze.com 2023-02-10 21:36 出处:网络
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.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消