fixes #2760: unable to register an account with a blank email

This commit is contained in:
Albert Yi
2017-01-16 14:56:08 -08:00
parent 04c221bf1e
commit ae442c3391

View File

@@ -68,6 +68,7 @@ class User < ActiveRecord::Base
validate :validate_ip_addr_is_not_banned, :on => :create validate :validate_ip_addr_is_not_banned, :on => :create
before_validation :normalize_blacklisted_tags before_validation :normalize_blacklisted_tags
before_validation :set_per_page before_validation :set_per_page
before_validation :normalize_email
before_create :encrypt_password_on_create before_create :encrypt_password_on_create
before_update :encrypt_password_on_update before_update :encrypt_password_on_update
before_create :initialize_default_boolean_attributes before_create :initialize_default_boolean_attributes
@@ -458,6 +459,10 @@ class User < ActiveRecord::Base
raise User::Error.new("Verification key does not match") raise User::Error.new("Verification key does not match")
end end
end end
def normalize_email
self.email = nil if email.blank?
end
end end
module BlacklistMethods module BlacklistMethods