summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.sqlx/query-57f1b5546a9071467b2f78f3384b853dcb23d73ef05398cab4d6767be9fb3d50.json12
-rw-r--r--.sqlx/query-9312110e144287cb2fc1fa2e59caae0cdc63e2bcb660474bfcb7e6bc9875f654.json20
-rw-r--r--src/login/repo/tokens.rs6
3 files changed, 23 insertions, 15 deletions
diff --git a/.sqlx/query-57f1b5546a9071467b2f78f3384b853dcb23d73ef05398cab4d6767be9fb3d50.json b/.sqlx/query-57f1b5546a9071467b2f78f3384b853dcb23d73ef05398cab4d6767be9fb3d50.json
deleted file mode 100644
index 464a475..0000000
--- a/.sqlx/query-57f1b5546a9071467b2f78f3384b853dcb23d73ef05398cab4d6767be9fb3d50.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "db_name": "SQLite",
- "query": "\n delete\n from token\n where secret = $1\n ",
- "describe": {
- "columns": [],
- "parameters": {
- "Right": 1
- },
- "nullable": []
- },
- "hash": "57f1b5546a9071467b2f78f3384b853dcb23d73ef05398cab4d6767be9fb3d50"
-}
diff --git a/.sqlx/query-9312110e144287cb2fc1fa2e59caae0cdc63e2bcb660474bfcb7e6bc9875f654.json b/.sqlx/query-9312110e144287cb2fc1fa2e59caae0cdc63e2bcb660474bfcb7e6bc9875f654.json
new file mode 100644
index 0000000..0de7e32
--- /dev/null
+++ b/.sqlx/query-9312110e144287cb2fc1fa2e59caae0cdc63e2bcb660474bfcb7e6bc9875f654.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "SQLite",
+ "query": "\n delete\n from token\n where secret = $1\n returning 1 as \"found: u32\"\n ",
+ "describe": {
+ "columns": [
+ {
+ "name": "found: u32",
+ "ordinal": 0,
+ "type_info": "Null"
+ }
+ ],
+ "parameters": {
+ "Right": 1
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "9312110e144287cb2fc1fa2e59caae0cdc63e2bcb660474bfcb7e6bc9875f654"
+}
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(())