Also lowercase the username when checking if it exists.

This commit is contained in:
Quentin Gliech
2025-04-10 18:45:13 +02:00
parent 7f0dcaa73f
commit b80a52e390
2 changed files with 3 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT EXISTS(\n SELECT 1 FROM users WHERE username = $1\n ) AS \"exists!\"\n ",
"query": "\n SELECT EXISTS(\n SELECT 1 FROM users WHERE LOWER(username) = LOWER($1)\n ) AS \"exists!\"\n ",
"describe": {
"columns": [
{
@@ -18,5 +18,5 @@
null
]
},
"hash": "94fd96446b237c87bd6bf741f3c42b37ee751b87b7fcc459602bdf8c46962443"
"hash": "7f8335cc94347bc3a15afe7051658659347a1bf71dd62335df046708f19c967e"
}

View File

@@ -250,7 +250,7 @@ impl UserRepository for PgUserRepository<'_> {
let exists = sqlx::query_scalar!(
r#"
SELECT EXISTS(
SELECT 1 FROM users WHERE username = $1
SELECT 1 FROM users WHERE LOWER(username) = LOWER($1)
) AS "exists!"
"#,
username