fix: better errors (where appropiate) for skynet address

Closes #17
This commit is contained in:
silver 2023-08-13 15:53:22 +01:00
parent 2e34658520
commit 9574f5e809
2 changed files with 3 additions and 2 deletions

View file

@ -34,7 +34,7 @@ pub mod password {
if let Some(mail) = &email {
if mail.trim().ends_with("@skynet.ie") {
// all responses from this are a success
return Ok(json!({"result": "success"}).into());
return Ok(json!({"result": "error", "error": "Skynet email not permitted."}).into());
}
}
@ -51,6 +51,7 @@ pub mod password {
// user does not have a different email address set
if user_details.mail.trim().ends_with("@skynet.ie") {
// not returning an error here as there is no need to let the person requesting what email the user has
return Ok(json!({"result": "success"}).into());
}

View file

@ -36,7 +36,7 @@ pub async fn submit(mut req: Request<State>) -> tide::Result {
// 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());
return Ok(json!({"result": "error", "error": "Skynet email not valid contact address"}).into());
}
let config = &req.state().config;