diff --git a/src/config/init.rs b/src/config/init.rs index 5985ed8..c39af3d 100644 --- a/src/config/init.rs +++ b/src/config/init.rs @@ -16,13 +16,13 @@ pub async fn init_users(mongo_client: Client) { name: "Debajyoti Saha".to_string(), email: "debajyotisaha14@gmail.com".to_string(), role: "admin".to_string(), - password: "debu14@".to_string(), + password: "Debu014@".to_string(), }, InitUser { name: "Rajdeep Sengupta".to_string(), email: "rajdipgupta019@gmail.com".to_string(), role: "admin".to_string(), - password: "raj19@".to_string(), + password: "Rajdeep19@".to_string(), }, InitUser { name: "Sourav Banik".to_string(), diff --git a/src/core/user.rs b/src/core/user.rs index f6d43ea..ae08af2 100644 --- a/src/core/user.rs +++ b/src/core/user.rs @@ -117,9 +117,7 @@ impl User { .await { Ok(Some(user)) => { - println!("User {:?}", user); let decrypted_user = user.decrypt(&dek_data.dek); - println!("Decrypted User {:?}", decrypted_user); return Ok(decrypted_user); } Ok(None) => Err(Error::UserNotFound { diff --git a/src/handlers/user_handler.rs b/src/handlers/user_handler.rs index 5ef3cfb..24a1d28 100644 --- a/src/handlers/user_handler.rs +++ b/src/handlers/user_handler.rs @@ -51,8 +51,6 @@ pub async fn update_user_handler( Err(e) => return Err(e), }; - println!(">> DEK DATA Decrypted: {:?}", dek_data); - // find the user in the users collection using the uid match collection .update_one( @@ -61,7 +59,7 @@ pub async fn update_user_handler( }, doc! { "$set": { - "name": payload.name.clone(), + "name": Encryption::encrypt_data(&payload.name, &dek_data.dek), "updated_at": DateTime::now(), } }, @@ -76,7 +74,6 @@ pub async fn update_user_handler( }); } Ok(Json(UpdateUserResponse { - message: "User updated".to_string(), email: payload.email.to_owned(), name: payload.name.to_owned(), })) diff --git a/src/models/user_model.rs b/src/models/user_model.rs index 5cb8ca2..6fcea4a 100644 --- a/src/models/user_model.rs +++ b/src/models/user_model.rs @@ -39,7 +39,6 @@ pub struct UpdateUserPayload { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UpdateUserResponse { - pub message: String, pub email: String, pub name: String, }