diff --git a/src/auth.rs b/src/auth.rs index 8cdc84f..f29b314 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1,4 +1,5 @@ extern crate log; +use uuid::Uuid; use crate::file_io::*; use rocket::http::{Cookie, Cookies}; use crate::user::*; @@ -25,7 +26,7 @@ pub fn register(data: Json) -> JsonValue { pronouns: data.pronouns.to_string().to_lowercase(), session_token: "NULL".to_string(), role: UserType::Normal, - + id: Uuid::new_v4(), }; db_add(&new_user); @@ -272,6 +273,7 @@ pub fn get_user(name: String) -> JsonValue { "name": user.name.to_lowercase(), "pronouns": user.pronouns, "role": user.role, + "id": user.id.to_string(), }, }); } else { diff --git a/src/user.rs b/src/user.rs index c7fe77c..3d43855 100644 --- a/src/user.rs +++ b/src/user.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use uuid::Uuid; /* User Data */ // enum of different user types @@ -17,6 +18,7 @@ pub struct User { pub pronouns: String, // user's pronouns pub session_token: String, // generated session token pub role: UserType, // type/role of user + pub id: Uuid, } /* Moderation Data */