Problem/Motivation
Prior to this issue 2478663 being fixed, if a user attempted to register with an existing e-mail address, but with a different case, the UserMailUnique constraint violation would be added. Stopping the user from being able to register/create an account with that email address.
Now a user is able to register with the same email address with different case multiple times.
E.g
email@test.com
Email@test.com
eMail@test.com
I think this is due to the fact that the sql query that searches for existing emails is case insensitive, and then the array_intersect which determines duplicate values is case sensitive.
Another interesting issue arises from the SQL query via the group by, where once I have entered an email address
e.g email@test.com
I am able to register with a different case
Email@test.com
multiple times. This is due to the groupBy condition returning the first email instance only (email@test.com) which is not matched in the array_intersect.
Steps to reproduce
Register/Create an account with an email address. e.g
email@test.com
Register/Create an account with the same email address, but a different case.
Email@test.com
eMail@test.com
EMAIL@test.com
Register/create an account with the same email address and same case (that does not match the case of the first email registered)
Email@test.com
Email@test.com
Email@test.com