From 99b33023332393e46f5a661901b980b78e6fb133 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Sun, 15 Sep 2024 23:25:51 -0400 Subject: Revoking a nonexistent token should fail --- src/login/repo/tokens.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/login') diff --git a/src/login/repo/tokens.rs b/src/login/repo/tokens.rs index 4d381ef..ec95f6a 100644 --- a/src/login/repo/tokens.rs +++ b/src/login/repo/tokens.rs @@ -44,18 +44,18 @@ impl<'c> Tokens<'c> { Ok(secret) } - /// Revoke a token by its secret. If there is no such token with that - /// secret, this will succeed by doing nothing. + /// Revoke a token by its secret. pub async fn revoke(&mut self, secret: &str) -> Result<(), sqlx::Error> { sqlx::query!( r#" delete from token where secret = $1 + returning 1 as "found: u32" "#, secret, ) - .execute(&mut *self.0) + .fetch_one(&mut *self.0) .await?; Ok(()) -- cgit v1.2.3