diff --git a/crates/pinakes-server/src/routes/auth.rs b/crates/pinakes-server/src/routes/auth.rs index b64bab0..1ca67a4 100644 --- a/crates/pinakes-server/src/routes/auth.rs +++ b/crates/pinakes-server/src/routes/auth.rs @@ -73,11 +73,14 @@ pub async fn login( let user = user.expect("user should exist at this point"); // Generate session token - use rand::Rng; - let token: String = rand::rng() - .sample_iter(&rand::distr::Alphanumeric) - .take(48) - .map(char::from) + let token: String = (0..48) + .map(|_| { + const CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ + abcdefghijklmnopqrstuvwxyz\ + 0123456789"; + let idx = (rand::random::() as usize) % CHARSET.len(); + CHARSET[idx] as char + }) .collect(); let role = user.role;