FEATURE: Add email normalization rules setting (#14593)

When this setting is turned on, it will check that normalized emails
are unique. Normalized emails are emails without any dots or plus
aliases.

This setting can be used to block use of aliases of the same email
address.
This commit is contained in:
Bianca Nenciu
2021-11-24 11:30:06 +02:00
committed by GitHub
parent a6aff40e4b
commit 3ea8937157
6 changed files with 76 additions and 8 deletions
@@ -0,0 +1,13 @@
# frozen_string_literal: true
class AddNormalizedEmailToUserEmail < ActiveRecord::Migration[6.1]
def change
add_column :user_emails, :normalized_email, :string
execute "CREATE INDEX index_user_emails_on_normalized_email ON user_emails (LOWER(normalized_email))"
end
def down
execute "DROP INDEX index_user_emails_on_normalized_email"
drop_column :user_emails, :normalized_email, :string
end
end