From 411f5fbd7e77b88e598aba2c4c15e39d135c12fc Mon Sep 17 00:00:00 2001 From: AINDUSTRIES Date: Sat, 15 Mar 2025 21:15:49 +0100 Subject: [PATCH] Added expiration time for revoked tokens --- src/users.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/users.rs b/src/users.rs index ae31742..0c3f91e 100644 --- a/src/users.rs +++ b/src/users.rs @@ -110,10 +110,12 @@ async fn logout(req: HttpRequest, app_state: Data) -> impl Responder { ); match token { Ok(token) => { + let exp = token.claims.exp as i64; if query!( - "INSERT INTO revoked ( token_id, user_id ) VALUES ( $1, $2 )", + "INSERT INTO revoked ( token_id, user_id, expires ) VALUES ( $1, $2, $3 )", token.claims.kid, - token.claims.uid + token.claims.uid, + exp ) .execute(&app_state.database) .await