Skip to content

Commit

Permalink
Update auth.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
secheng722 committed May 20, 2024
1 parent 76f8c4c commit 4794b10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/admin/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ pub fn decode_token(token: &str) -> bool {
&DecodingKey::from_secret(JWT_SECRET.as_ref()),
&jsonwebtoken::Validation::new(jsonwebtoken::Algorithm::HS256),
)
.is_ok()
.map_err(|_| anyhow::anyhow!("Failed to decode token"))
.unwrap()
.claims
.exp > OffsetDateTime::now_utc().unix_timestamp()
}

0 comments on commit 4794b10

Please sign in to comment.