Closed othercorey closed 2 years ago
Lowercasing in PHp would be not needed if case insensitive db field is used. I would rather have users do that instead.
Lowercasing in PHp would be not needed if case insensitive db field is used. I would rather have users do that instead.
This isn't a supported data type in postgres unfortunately. There are ways to do case-insensitive string compares, but I don't think it's standard.
The alternative is a custom resolver just for usernames which is what I use.
Wouldn't you have to lowercase case the db value too to ensure a match? Lowercasing the user provided value won't help if the value stored in db is not in lowercase (for Postgres).
Wouldn't you have to lowercase case the db value too to ensure a match? Lowercasing the user provided value won't help if the value stored in db is not in lowercase (for Postgres).
Yes, you would need to have entity setters or save logic to lowercase the fields.
Yes, you would need to have entity setters or save logic to lowercase the fields.
I would hate it if an app/site did that :). For e.g. my GH username is mixed cased and that's what's shown/works everywhere (I haven't set any display name). But I can still login using lower cased version of my username.
So I think the db should store the exact string user provided during account creation and the lowercasing of db value too should be done in query. So perhaps this option belongs in the Orm resolver?
Ok, will stick with a specialized solution.
So I think the db should store the exact string user provided during account creation and the lowercasing of db value too should be done in query. So perhaps this option belongs in the Orm resolver?
Yes, that's the optimal solution. I use a lowercase index to ensure unique case-insensitive email addresses.
I don't run into the display name issue you mentioned because username
is email, but it's a good point.
Even Email some people prefer different casing for readability :) so should usually also not get lowercased maybe.
This allows case-insensitive usernames when the username is always forced to lowercase when storing in the db.
This can reduce the dependency on the UI to always send case-insensitive strings to the server.