diff --git a/src/auth.rs b/src/auth.rs index 1a602a5c..a4a0b22c 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1174,7 +1174,7 @@ impl AuthTokens { let access_claims = LoginJwtClaims::default(device, user, &sub, client_id); - let validity = if DeviceType::is_mobile(&device.atype) { + let validity = if device.is_mobile() { *MOBILE_REFRESH_VALIDITY } else { *DEFAULT_REFRESH_VALIDITY diff --git a/src/db/models/device.rs b/src/db/models/device.rs index 91cc1e18..005d942d 100644 --- a/src/db/models/device.rs +++ b/src/db/models/device.rs @@ -70,6 +70,10 @@ impl Device { pub fn is_cli(&self) -> bool { matches!(DeviceType::from_i32(self.atype), DeviceType::WindowsCLI | DeviceType::MacOsCLI | DeviceType::LinuxCLI) } + + pub fn is_mobile(&self) -> bool { + matches!(DeviceType::from_i32(self.atype), DeviceType::Android | DeviceType::Ios) + } } pub struct DeviceWithAuthRequest { @@ -353,10 +357,6 @@ impl DeviceType { _ => DeviceType::UnknownBrowser, } } - - pub fn is_mobile(value: &i32) -> bool { - *value == DeviceType::Android as i32 || *value == DeviceType::Ios as i32 - } } #[derive(