FIX: validate Invite email against EmailValidator.email_regex (#6975)

This commit is contained in:
Arpit Jalan
2019-02-06 22:38:06 +05:30
committed by GitHub
parent ca03b2ff30
commit ab2c2ea605
3 changed files with 10 additions and 3 deletions

View File

@@ -16,7 +16,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
validates :email, email: true, format: { with: EmailValidator.email_regex }
before_create do
self.invite_key ||= SecureRandom.hex