fix: better errors (where appropiate) for skynet address #40
2 changed files with 3 additions and 2 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue