Fix cargo clippy issues
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-08-28 08:05:22 +02:00
parent cd4b8af445
commit a1e23efd99
8 changed files with 110 additions and 114 deletions

View File

@@ -128,21 +128,21 @@ impl FromRequest for ApiAuthExtractor {
));
}
if let Some(ip) = token.ip_restriction {
if !ip.contains(remote_ip.0) {
log::error!(
"Attempt to use a token for an unauthorized IP! {remote_ip:?} token_id={}",
token.id.0
);
return Err(ErrorUnauthorized("Token cannot be used from this IP!"));
}
if let Some(ip) = token.ip_restriction
&& !ip.contains(remote_ip.0)
{
log::error!(
"Attempt to use a token for an unauthorized IP! {remote_ip:?} token_id={}",
token.id.0
);
return Err(ErrorUnauthorized("Token cannot be used from this IP!"));
}
if token.should_update_last_activity() {
if let Err(e) = api_tokens::refresh_last_used(token.id).await {
log::error!("Could not update token last activity! {e}");
return Err(ErrorBadRequest("Couldn't refresh token last activity!"));
}
if token.should_update_last_activity()
&& let Err(e) = api_tokens::refresh_last_used(token.id).await
{
log::error!("Could not update token last activity! {e}");
return Err(ErrorBadRequest("Couldn't refresh token last activity!"));
}
Ok(ApiAuthExtractor { token, claims })