Hello,
People who use nopcommerce v4.6 and Postgresql, emails are case sensitive at login page. However at the Customer table, "Email" column defined as "Citiext" data type which allows us to avoid case sensitivity issues. For example, we have a registered user with [email protected]. Select * from "Customer" where "Email" = '[email protected]' will get us the data of that user. But when we try to log in with "[email protected]" we will get the "No account found" notification.
In the "LinqToDBPostgreSQLDataProvider.cs" file line 18, there is an if control :
public override void SetParameter(DataConnection dataConnection, DbParameter parameter, string name, DbDataType dataType, object value)
{
if (value is string && dataType.DataType == DataType.NVarChar)
{
dataType = dataType.WithDbType("citext");
}
base.SetParameter(dataConnection, parameter, name, dataType, value);
}
In this if control it checks the Datatype. But the mail data type is "TEXT". Thus, mail object can't pass this if statement and dbType value will be null which suppose to be "citiext". Because of this, query result will be null and user get "No account found" notification. To show the difference between data type "Text" and "citiext" :
DO $$
DECLARE
email TEXT := '[email protected]';
result_email TEXT;
BEGIN
SELECT c_1."Email" INTO result_email
FROM public."Customer" c_1
WHERE c_1."Email" = email;
RAISE NOTICE 'Result Email: %', result_email;
END $$;
---------------------------------------------------------------------------------------------------------
DO $$
DECLARE
email CITEXT := '[email protected]';
result_email CITEXT;
BEGIN
SELECT c_1."Email" INTO result_email
FROM public."Customer" c_1
WHERE c_1."Email" = email;
RAISE NOTICE 'Result Email: %', result_email;
END $$;
In the first query result is null. On the other hand, result will not be null. I'm not so sure about this but I think it is worth to look at.