mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: EmailValidator needs to validate format of email.
This commit is contained in:
@@ -18,7 +18,7 @@ class Invite < ActiveRecord::Base
|
||||
has_many :topic_invites
|
||||
has_many :topics, through: :topic_invites, source: :topic
|
||||
validates_presence_of :invited_by_id
|
||||
validates :email, email: true, format: { with: EmailValidator.email_regex }, allow_blank: true
|
||||
validates :email, email: true, allow_blank: true
|
||||
|
||||
before_create do
|
||||
self.invite_key ||= SecureRandom.hex
|
||||
|
||||
@@ -11,8 +11,7 @@ class UserEmail < ActiveRecord::Base
|
||||
before_validation :strip_downcase_email
|
||||
|
||||
validates :email, presence: true
|
||||
validates :email, email: true, format: { with: EmailValidator.email_regex },
|
||||
if: :validate_email?
|
||||
validates :email, email: true, if: :validate_email?
|
||||
|
||||
validates :primary, uniqueness: { scope: [:user_id] }, if: [:user_id, :primary]
|
||||
validate :user_id_not_changed, if: :primary
|
||||
|
||||
Reference in New Issue
Block a user