fix: make username login case-insensitive (#3981)

Normalize usernames to lowercase on lookup, creation, and update.
Also fix variable shadowing bug and same-user update check in
the user update endpoint.
This commit is contained in:
Niels Kaspers committed 2026-04-08 09:14:41 +03:00
1 parent 0a838649b7
commit 7ca24786e8
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@ export async function getUser(userId: string, options: GetUserOptions = {}) {
}
export async function getUserByUsername(username: string, options: GetUserOptions = {}) {
return findUser({ where: { username } }, options);
return findUser({ where: { username: username.toLowerCase() } }, options);
}
export async function getUsers(criteria: UserFindManyArgs, filters: QueryFilters = {}) {