Added expiration time for revoked tokens

This commit is contained in:
2025-03-15 21:15:49 +01:00
parent b90eea57f0
commit 411f5fbd7e

View File

@@ -110,10 +110,12 @@ async fn logout(req: HttpRequest, app_state: Data<AppState>) -> impl Responder {
); );
match token { match token {
Ok(token) => { Ok(token) => {
let exp = token.claims.exp as i64;
if query!( 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.kid,
token.claims.uid token.claims.uid,
exp
) )
.execute(&app_state.database) .execute(&app_state.database)
.await .await