Filter email on ASCII

This commit is contained in:
Mathieu Strypsteen 2024-03-31 18:29:37 +02:00
parent 0d91315d20
commit 26b00f4c54

View file

@ -29,7 +29,7 @@ async fn handler(Query(request): Query<GenerateRequest>) -> Result<Json<Generate
if request.secret != *API_SECRET { if request.secret != *API_SECRET {
return Err(StatusCode::UNAUTHORIZED); return Err(StatusCode::UNAUTHORIZED);
} }
if !request.email.contains('@') { if !request.email.is_ascii() || !request.email.contains('@') {
return Err(StatusCode::UNAUTHORIZED); return Err(StatusCode::UNAUTHORIZED);
} }
println!("{}", request.email); println!("{}", request.email);