fix bug and sqlx prepare
All checks were successful
Build and Test / account (push) Successful in 3m27s
All checks were successful
Build and Test / account (push) Successful in 3m27s
This commit is contained in:
parent
672674f7ad
commit
fa063d78fb
3 changed files with 56 additions and 7 deletions
40
.sqlx/query-48fd98db66a68865babe4ac6a453de747bba2ce1da198dda4b6f3b78eacfebf3.json
generated
Normal file
40
.sqlx/query-48fd98db66a68865babe4ac6a453de747bba2ce1da198dda4b6f3b78eacfebf3.json
generated
Normal 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"
|
||||
}
|
||||
15
.sqlx/query-6c276038b92bef06b30da32dab42256be431b361cfd36754aa41b6da220618cc.json
generated
Normal file
15
.sqlx/query-6c276038b92bef06b30da32dab42256be431b361cfd36754aa41b6da220618cc.json
generated
Normal 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"
|
||||
}
|
||||
|
|
@ -200,15 +200,9 @@ pub async fn forgotten_password(
|
|||
let nintendo_hash = crate::account::account::generate_password(pid, &cleartext_password)
|
||||
.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!(
|
||||
"UPDATE users SET password = $1 WHERE pid = $2",
|
||||
hashed_password,
|
||||
nintendo_hash,
|
||||
pid
|
||||
)
|
||||
.execute(db)
|
||||
|
|
|
|||
Loading…
Reference in a new issue