fix: revoke stale account recovery credentials

This commit is contained in:
237899745
2026-07-26 03:07:04 +08:00
parent 1f55bd45ca
commit 03d0e43d4d
5 changed files with 352 additions and 17 deletions

View File

@@ -856,14 +856,7 @@ async fn reset_password(
.await
.map_err(|err| AppError::new(ErrorCode::Internal, "更新密码失败").with_source(err))?;
sqlx::query(
"UPDATE password_resets SET used_at = $2 WHERE token_hash = $1 AND used_at IS NULL",
)
.bind(token_hash)
.bind(now)
.execute(&mut *tx)
.await
.map_err(|err| AppError::new(ErrorCode::Internal, "更新重置记录失败").with_source(err))?;
credentials::invalidate_account_recovery(&mut tx, user_id, now).await?;
tx.commit()
.await