From 6b7e49c666a2b30237bff3af11a042b9a51153d2 Mon Sep 17 00:00:00 2001 From: Timshel Date: Mon, 15 Apr 2024 16:06:18 +0200 Subject: [PATCH] Stop rolling device token --- src/auth.rs | 3 +-- src/db/models/device.rs | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index b0bc06a5..62a4f506 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1098,8 +1098,7 @@ pub async fn refresh_tokens(refresh_token: &str, conn: &mut DbConn) -> ApiResult Some(device) => device, }; - // Roll the Device.refresh_token this way it invalides old JWT refresh_token - device.roll_refresh_token(); + // Save to update `updated_at`. device.save(conn).await?; let user = match User::find_by_uuid(&device.user_uuid, conn).await { diff --git a/src/db/models/device.rs b/src/db/models/device.rs index 86775455..0c4624ca 100644 --- a/src/db/models/device.rs +++ b/src/db/models/device.rs @@ -48,10 +48,6 @@ impl Device { } } - pub fn roll_refresh_token(&mut self) { - self.refresh_token = crypto::encode_random_bytes::<64>(BASE64URL) - } - pub fn refresh_twofactor_remember(&mut self) -> String { let twofactor_remember = crypto::encode_random_bytes::<180>(BASE64); self.twofactor_remember = Some(twofactor_remember.clone());