about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb3
-rw-r--r--app/models/user.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index ac5137131..8891adb54 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -57,7 +57,8 @@ class Account < ApplicationRecord
   validates :username, uniqueness: { scope: :domain, case_sensitive: true }, if: -> { !local? && username_changed? }
 
   # Local user validations
-  validates :username, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, unreserved: true, if: -> { local? && username_changed? }
+  validates :username, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: -> { local? && username_changed? }
+  validates_with UnreservedUsernameValidator, if: -> { local? && username_changed? }
   validates :display_name, length: { maximum: 30 }, if: -> { local? && display_name_changed? }
   validates :note, length: { maximum: 160 }, if: -> { local? && note_changed? }
 
diff --git a/app/models/user.rb b/app/models/user.rb
index 0fd3983b4..ca11f2f5d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -47,7 +47,7 @@ class User < ApplicationRecord
   accepts_nested_attributes_for :account
 
   validates :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale?
-  validates :email, email: true, if: :email_changed?
+  validates_with BlacklistedEmailValidator, if: :email_changed?
 
   scope :recent,    -> { order(id: :desc) }
   scope :admins,    -> { where(admin: true) }