mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: send email to normalized email owner when hiding emails (#23524)
Previous to this change when both `normalize_emails` and `hide_email_address_taken` is enabled the expected `account_exists` email was only sent on exact email matches. This expands it so it also sends an email to the canonical email owner.
This commit is contained in:
@ -767,7 +767,12 @@ class UsersController < ApplicationController
|
||||
user.errors[:primary_email]&.include?(I18n.t("errors.messages.taken"))
|
||||
session["user_created_message"] = activation.success_message
|
||||
|
||||
if existing_user = User.find_by_email(user.primary_email&.email)
|
||||
existing_user = User.find_by_email(user.primary_email&.email)
|
||||
if !existing_user && SiteSetting.normalize_emails
|
||||
existing_user =
|
||||
UserEmail.find_by_normalized_email(user.primary_email&.normalized_email)&.user
|
||||
end
|
||||
if existing_user
|
||||
Jobs.enqueue(:critical_user_email, type: "account_exists", user_id: existing_user.id)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user