X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/898cc828dd1f1167f85abbf35c8e3f0ed640ac1e..1debc147b8c4d9c917d54a279dcf0e2718e0665e:/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)