Skip to content

Commit 67e71d4

Browse files
committed
fix: reject emails with empty local part in role-based validation
Adds check to prevent @example.com from being processed as valid email format. Fixes failing CI test for invalid email format validation.
1 parent 5941621 commit 67e71d4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/handlers/validation/role_based.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ use std::env;
2222
/// ```
2323
pub async fn is_role_based_email(email: &str) -> Result<bool, String> {
2424
let at_pos = email.find('@').ok_or("Invalid email format")?;
25+
if at_pos == 0 {
26+
return Err("Invalid email format".to_string());
27+
}
2528
let local_part = email[..at_pos].to_lowercase();
2629

2730
let mongo_uri =

0 commit comments

Comments
 (0)