From 9e6572fa282a18fecfb31a2c35c17c0e8c23e371 Mon Sep 17 00:00:00 2001 From: pennae Date: Mon, 25 Jul 2022 02:26:35 +0200 Subject: remove dependency on chrono prompted by a cargo audit run. time works just as well and is better maintained. web-push still uses chrono, but from the looks of things it won't be affected. --- src/api/auth/invite.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/api/auth/invite.rs') diff --git a/src/api/auth/invite.rs b/src/api/auth/invite.rs index e70c3d6..ecd39f9 100644 --- a/src/api/auth/invite.rs +++ b/src/api/auth/invite.rs @@ -1,7 +1,7 @@ use base64::URL_SAFE_NO_PAD; -use chrono::{Duration, Utc}; use rocket::{http::uri::Reference, serde::json::Json, State}; use serde::{Deserialize, Serialize}; +use time::{Duration, OffsetDateTime}; use crate::{api::auth, auth::Authenticated, crypto::random_bytes, db::DbConn, Config}; @@ -13,7 +13,7 @@ pub(crate) async fn generate_invite_link( ttl: Duration, ) -> anyhow::Result> { let code = base64::encode_config(&random_bytes::<32>(), URL_SAFE_NO_PAD); - db.add_invite_code(&code, Utc::now() + ttl).await?; + db.add_invite_code(&code, OffsetDateTime::now_utc() + ttl).await?; Reference::parse_owned(format!("{}/#/register/{}", cfg.location, code)) .map_err(|e| anyhow!("url building failed at {e}")) } -- cgit v1.2.3