Ignore Rocket.toml

This commit is contained in:
Paul Makles
2020-06-14 09:54:01 +01:00
parent 8043690d38
commit 50ef5c43c7
6 changed files with 390 additions and 412 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
Rocket.toml
/target /target
**/*.rs.bk **/*.rs.bk
.env .env

783
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
[development]
address = "192.168.0.10"
port = 5500
[production]
address = "192.168.0.10"
port = 3000

View File

@@ -78,7 +78,6 @@ pub fn create(info: Json<Create>) -> Response {
let sent = email::send_verification_email(info.email.clone(), code); let sent = email::send_verification_email(info.email.clone(), code);
Response::Success(json!({ Response::Success(json!({
"success": true,
"email_sent": sent, "email_sent": sent,
})) }))
} }
@@ -200,13 +199,13 @@ pub fn resend_email(info: Json<Resend>) -> Response {
match email::send_verification_email(info.email.to_string(), code) { match email::send_verification_email(info.email.to_string(), code) {
true => Response::Result(super::Status::Ok), true => Response::Result(super::Status::Ok),
false => Response::InternalServerError( false => Response::InternalServerError(
json!({ "success": false, "error": "Failed to send email! Likely an issue with the backend API." }), json!({ "error": "Failed to send email! Likely an issue with the backend API." }),
), ),
} }
} }
} else { } else {
Response::NotFound( Response::NotFound(
json!({ "success": false, "error": "Email not found or pending verification!" }), json!({ "error": "Email not found or pending verification!" }),
) )
} }
} }

View File

@@ -531,6 +531,10 @@ pub fn send_message(
let content: String = message.content.chars().take(2000).collect(); let content: String = message.content.chars().take(2000).collect();
let nonce: String = message.nonce.chars().take(32).collect(); let nonce: String = message.nonce.chars().take(32).collect();
if content.len() == 0 {
return Some(Response::NotAcceptable(json!({ "error": "No message content!" })));
}
let col = database::get_collection("messages"); let col = database::get_collection("messages");
if col if col
.find_one(doc! { "nonce": nonce.clone() }, None) .find_one(doc! { "nonce": nonce.clone() }, None)

View File

@@ -6,6 +6,6 @@ use bson::doc;
#[get("/")] #[get("/")]
pub fn root() -> Response { pub fn root() -> Response {
Response::Success(json!({ Response::Success(json!({
"revolt": "0.1.0" "revolt": "0.2.0"
})) }))
} }