users: move sockpuppet detection from model to controller.
This commit is contained in:
@@ -78,7 +78,6 @@ class User < ApplicationRecord
|
||||
validates_inclusion_of :per_page, in: (1..PostSets::Post::MAX_PER_PAGE)
|
||||
validates_confirmation_of :password
|
||||
validates_presence_of :comment_threshold
|
||||
validate :validate_sock_puppets, :on => :create, :if => -> { Danbooru.config.enable_sock_puppet_validation? }
|
||||
before_validation :normalize_blacklisted_tags
|
||||
before_create :promote_to_admin_if_first_user
|
||||
before_create :customize_new_user
|
||||
@@ -623,14 +622,6 @@ class User < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
concerning :SockPuppetMethods do
|
||||
def validate_sock_puppets
|
||||
if User.where(last_ip_addr: CurrentUser.ip_addr).where("created_at > ?", 1.day.ago).exists?
|
||||
errors.add(:last_ip_addr, "was used recently for another account and cannot be reused for another day")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include BanMethods
|
||||
include PasswordMethods
|
||||
include AuthenticationMethods
|
||||
|
||||
Reference in New Issue
Block a user