Skip to content

Commit

Permalink
Only run email checks if email changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Aug 6, 2020
1 parent 239a4f3 commit 2e85331
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def username_not_fake_admin

def email_domain_not_blocklisted
return unless File.exist?(Rails.root.join('../.qpixel-domain-blocklist.txt'))
return unless saved_changes.include? 'email'

blocklist = File.read(Rails.root.join('../.qpixel-domain-blocklist.txt')).split("\n")
email_domain = email.split('@')[-1]
Expand Down Expand Up @@ -158,6 +159,7 @@ def is_not_blocklisted

def email_not_bad_pattern
return unless File.exist?(Rails.root.join('../.qpixel-email-patterns.txt'))
return unless saved_changes.include? 'email'

patterns = File.read(Rails.root.join('../.qpixel-email-patterns.txt')).split("\n")
matched = patterns.select { |p| email.match? Regexp.new(p) }
Expand Down

0 comments on commit 2e85331

Please sign in to comment.