emails: add script to delete invalid emails.
We used to not validate user email addresses, which means we have a lot of users with invalid emails. This script deletes all emails that are missing both an `@` and a `.` This amounts to about 3000 invalid emails. There are an additional ~1000 emails that are missing just the `@` sign. Many of these are simple typos, for example skipping the `@` or typing a 2 instead. Some of these may be manually fixable. This fixes an issue where upgrading to Gold could fail if you had an invalid email address, because we prefilled the buyer's email address on the Stripe checkout page and an invalid email would cause Stripe to throw an error.
This commit is contained in:
7
script/fixes/067_delete_invalid_email_addresses.rb
Executable file
7
script/fixes/067_delete_invalid_email_addresses.rb
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative "../../config/environment"
|
||||
|
||||
EmailAddress.transaction do
|
||||
EmailAddress.where("address !~ ? AND address !~ ?", "@", "\\.").count
|
||||
end
|
||||
Reference in New Issue
Block a user