forked from spacebar/account
fix bug and sqlx prepare
This commit is contained in:
parent
672674f7ad
commit
fa063d78fb
3 changed files with 56 additions and 7 deletions
|
|
@ -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