diff options
author | cel 🌸 <cel@blos.sm> | 2023-12-13 06:50:44 +0000 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-12-13 06:50:44 +0000 |
commit | a971d8c2dc519b1db805c72cf3395c188a98dff4 (patch) | |
tree | 98e7db2d690b778b605cf8027cd14ad1eae1f053 /src/users.rs | |
parent | a587459a1817c0fc57b46df3f9c69567e1e775b7 (diff) | |
download | pinussy-a971d8c2dc519b1db805c72cf3395c188a98dff4.tar.gz pinussy-a971d8c2dc519b1db805c72cf3395c188a98dff4.tar.bz2 pinussy-a971d8c2dc519b1db805c72cf3395c188a98dff4.zip |
switch to uuids
Diffstat (limited to '')
-rw-r--r-- | src/users.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/users.rs b/src/users.rs index 4cf9310..e8b0b67 100644 --- a/src/users.rs +++ b/src/users.rs @@ -1,12 +1,14 @@ use bcrypt::hash; use bcrypt::verify; use bcrypt::DEFAULT_COST; +use uuid::Uuid; use crate::Privacy; use crate::Result; #[derive(sqlx::FromRow)] pub struct User { + pub id: Uuid, pub username: String, pub password: String, pub email: Option<String>, @@ -19,7 +21,9 @@ pub struct User { impl User { pub fn new(username: String, password: String) -> Result<Self> { let password_hash = hash(password, DEFAULT_COST)?; + let id = Uuid::new_v4(); Ok(Self { + id, username, password: password_hash, email: None, |