fix: better errors (where appropiate) for skynet address #40

Merged
silver merged 2 commits from #17-better-errors-for-skynet-address into main 2023-08-13 15:02:45 +00:00
2 changed files with 3 additions and 2 deletions
Showing only changes of commit 9574f5e809 - Show all commits

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;