diff --git a/openapi.yaml b/docs/api-docs/openapi.yaml similarity index 100% rename from openapi.yaml rename to docs/api-docs/openapi.yaml diff --git a/src/handlers/user_handler.rs b/src/handlers/user_handler.rs index b55aec6..5ef3cfb 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), }; - // let kek = env::var("SERVER_KEK").expect("Server Kek must be set."); - println!(">> DEK DATA Decrypted: {:?}", dek_data); // find the user in the users collection using the uid diff --git a/src/utils/validation_utils.rs b/src/utils/validation_utils.rs index 2bd4f2f..900214b 100644 --- a/src/utils/validation_utils.rs +++ b/src/utils/validation_utils.rs @@ -8,17 +8,42 @@ impl Validation { } pub fn password(password: &str) -> bool { - let mut has_alpha = false; - let mut has_digit = false; - - for c in password.chars() { - if c.is_ascii_alphabetic() { - has_alpha = true; - } else if c.is_ascii_digit() { - has_digit = true; - } + // Minimum length requirement + let min_length = 8; + if password.len() < min_length { + return false; } - has_alpha && has_digit && password.len() >= 8 + // Check for at least one lowercase letter + let has_lowercase = password.chars().any(|c| c.is_lowercase()); + if !has_lowercase { + return false; + } + + // Check for at least one uppercase letter + let has_uppercase = password.chars().any(|c| c.is_uppercase()); + if !has_uppercase { + return false; + } + + // Check for at least one number + let has_number = password.chars().any(|c| c.is_numeric()); + if !has_number { + return false; + } + + // Check for at least one special character + let has_special = password.chars().any(|c| c.is_ascii_punctuation()); + if !has_special { + return false; + } + + // No whitespace allowed + if password.contains(' ') { + return false; + } + + // Password is valid + return true; } }