mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-22 22:28:22 +03:00
add card expiry checks
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use std::{sync::{Mutex, OnceLock}, time::{Duration, Instant}};
|
||||
|
||||
use tracing::debug;
|
||||
|
||||
use crate::utils::{parse_access_code, parse_idm_hex};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -52,7 +54,13 @@ impl CardPresenter {
|
||||
}
|
||||
}
|
||||
|
||||
guard.take()
|
||||
let card = guard.take();
|
||||
if let Some(ref stored_card) = card && stored_card.is_expired() {
|
||||
debug!("Stored card has expired and will not be provided");
|
||||
return None;
|
||||
};
|
||||
|
||||
card
|
||||
}
|
||||
|
||||
pub fn present_card(&self, access_code: &String, idm_hex: Option<&String>, validity: Duration) -> CardPresentResult {
|
||||
|
||||
Reference in New Issue
Block a user