starting to move back to rust webserver

This commit is contained in:
Chris Cochrun 2024-06-21 12:27:39 -05:00
parent 4f3ca354dc
commit 412a9711d7
4 changed files with 19 additions and 5 deletions

View file

@ -1,9 +1,7 @@
use std::fs;
use actix_multipart::form::{tempfile::TempFile, text::Text, MultipartForm};
use actix_multipart::form::{text::Text, MultipartForm};
use actix_web::{post, HttpResponse};
use lettre::{
message::{header::ContentType, Attachment, MultiPart, SinglePart},
message::MultiPart,
transport::smtp::authentication::{Credentials, Mechanism},
Message, SmtpTransport, Transport,
};
@ -35,6 +33,7 @@ struct CampForm {
#[post("/camp-form")]
pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResponse {
log::info!("a new form");
let first = form
.first_name
.as_ref()
@ -166,6 +165,7 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
})
.0
.clone();
let reg = registration.clone().as_str();
log::info!("{first} {last} signed up for camp!");
let email = markup::new! {
@markup::doctype()
@ -282,5 +282,19 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
log::info!("Email incorrect");
}
match reg {
"now" => {
log::info!("Sending them to pay for registration now");
}
"full" => {
log::info!("Sending them to pay for the full registration now");
}
"later" => {
log::info!("They'd like to pay later");
}
_ => {
log::error!("Got registration error.....");
}
}
HttpResponse::Ok().body("thankyou")
}