mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:51:07 +08:00
FIX: skip email if blank while syncing SSO attributes. (#19939)
Also, return email blank error in `EmailValidator` when the email is blank.
This commit is contained in:
@ -2,7 +2,10 @@
|
||||
|
||||
class EmailValidator < ActiveModel::EachValidator
|
||||
def validate_each(record, attribute, value)
|
||||
if !EmailAddressValidator.valid_value?(value)
|
||||
if value.blank?
|
||||
record.errors.add(attribute, I18n.t(:"user.email.blank"))
|
||||
invalid = true
|
||||
elsif !EmailAddressValidator.valid_value?(value)
|
||||
if Invite === record && attribute == :email
|
||||
record.errors.add(:base, I18n.t(:"invite.invalid_email", email: CGI.escapeHTML(value)))
|
||||
else
|
||||
|
Reference in New Issue
Block a user