summaryrefslogtreecommitdiff
path: root/src/routes/auth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/auth.rs')
-rw-r--r--src/routes/auth.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/routes/auth.rs b/src/routes/auth.rs
index 4fb9124..979e617 100644
--- a/src/routes/auth.rs
+++ b/src/routes/auth.rs
@@ -2,7 +2,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
use axum::extract::{Json, State, FromRequestParts};
use axum::response::IntoResponse;
-use axum::http::{StatusCode, request::Parts};
+use axum::http::{request::Parts};
use axum_extra::extract::CookieJar;
use axum_extra::extract::cookie::{Cookie, SameSite};
use jsonwebtoken::{DecodingKey, EncodingKey, Header, Validation, decode, encode};
@@ -21,6 +21,7 @@ pub struct Claims {
pub sub: String,
pub exp: usize,
pub iat: usize,
+ pub username: String,
pub is_admin: bool,
}
@@ -92,6 +93,7 @@ pub async fn login(
sub: user.email().to_string(),
iat: now,
exp: now + 60 * 60 * 24,
+ username: user.username().to_string(),
is_admin: false
};