diff options
Diffstat (limited to 'src/routes/auth.rs')
| -rw-r--r-- | src/routes/auth.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/routes/auth.rs b/src/routes/auth.rs index ab7a393..8e8d99b 100644 --- a/src/routes/auth.rs +++ b/src/routes/auth.rs @@ -18,9 +18,10 @@ use crate::routes::errors::RouteError; #[derive(Serialize, Deserialize)] pub struct Claims { - pub sub: String, + pub sub: i64, pub exp: usize, pub iat: usize, + pub email: String, pub username: String, pub is_admin: bool, } @@ -90,9 +91,10 @@ pub async fn login( .as_secs() as usize; let claims = Claims { - sub: user.email().to_string(), + sub: user.id(), iat: now, exp: now + 60 * 60 * 24, + email: user.email().to_string(), username: user.username().to_string(), is_admin: false }; |
