- :format => { :with => /\A[^#{INVALID_NON_ASCII_CHARS}]*\z/ }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\A[^#{INVALID_ASCII_CHARS}]*\z/,
- :message => I18n.t("users.account.invalid chars", :invalid_chars => INVALID_ASCII_CHARS) }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\A\S/, :message => I18n.t("users.account.leading whitespace") }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\S\z/, :message => I18n.t("users.account.trailing whitespace") }
- validates :email, :presence => true, :confirmation => true
+ :characters => { :url_safe => true },
+ :whitespace => { :leading => false, :trailing => false }
+ validates :email, :presence => true, :confirmation => true, :characters => true