From 77917477fedac68b30d22dab77f004e131a622a2 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sat, 29 Jul 2023 17:16:29 +0100 Subject: [PATCH] fix: disallow using skynet email as a contact address closes #1 --- src/methods/account_update.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/methods/account_update.rs b/src/methods/account_update.rs index 8733210..6ec2bac 100644 --- a/src/methods/account_update.rs +++ b/src/methods/account_update.rs @@ -22,6 +22,11 @@ pub async fn post_update_ldap(mut req: Request) -> tide::Result { value, } = req.body_json().await?; + // check that any mail is not using @skynet.ie + if field == "mail" && value.trim().ends_with("@skynet.ie") { + return Ok(json!({"result": "error", "error": "skynet email not valid contact address"}).into()); + } + let config = &req.state().config; // easier to give each request its own connection