fix bug and sqlx prepare
All checks were successful
Build and Test / account (push) Successful in 3m27s

This commit is contained in:
red binder 2026-08-10 22:08:17 +02:00
commit fa063d78fb
3 changed files with 56 additions and 7 deletions

View file

@ -0,0 +1,40 @@
{
"db_name": "PostgreSQL",
"query": "SELECT username, email FROM users WHERE pid = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "username",
"type_info": "Varchar",
"origin": {
"Table": {
"table": "users",
"name": "username"
}
}
},
{
"ordinal": 1,
"name": "email",
"type_info": "Varchar",
"origin": {
"Table": {
"table": "users",
"name": "email"
}
}
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false,
false
]
},
"hash": "48fd98db66a68865babe4ac6a453de747bba2ce1da198dda4b6f3b78eacfebf3"
}

View file

@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE users SET password = $1 WHERE pid = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Int4"
]
},
"nullable": []
},
"hash": "6c276038b92bef06b30da32dab42256be431b361cfd36754aa41b6da220618cc"
}

View file

@ -200,15 +200,9 @@ pub async fn forgotten_password(
let nintendo_hash = crate::account::account::generate_password(pid, &cleartext_password) let nintendo_hash = crate::account::account::generate_password(pid, &cleartext_password)
.ok_or(UNAUTHORIZED_DEVICE_ERROR)?; .ok_or(UNAUTHORIZED_DEVICE_ERROR)?;
let hashed_password = bcrypt::hash(nintendo_hash, 10)
.map_err(|e| {
eprintln!("bcrypt error: {e}");
UNAUTHORIZED_DEVICE_ERROR
})?;
let update_result = sqlx::query!( let update_result = sqlx::query!(
"UPDATE users SET password = $1 WHERE pid = $2", "UPDATE users SET password = $1 WHERE pid = $2",
hashed_password, nintendo_hash,
pid pid
) )
.execute(db) .execute(db)