X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0c8ad2f86edefed72052b402742cadedb0d674d9..3458d881af4584e44d72bb682771e3c7a3cf6e68:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 778afbf8a..6677d3b98 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -52,6 +52,7 @@ class User < ActiveRecord::Base after_initialize :set_defaults before_save :encrypt_password + after_save :spam_check has_attached_file :image, :default_url => "/assets/:class/:attachment/:style.png", @@ -216,6 +217,14 @@ class User < ActiveRecord::Base return score.to_i end + ## + # perform a spam check on a user + def spam_check + if status == "active" and spam_score > SPAM_THRESHOLD + update_column(:status, "suspended") + end + end + ## # return an oauth access token for a specified application def access_token(application_key)