starting to move back to rust webserver
This commit is contained in:
parent
4f3ca354dc
commit
412a9711d7
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div id="mt-form" class="form text-lg w-full">
|
<div id="mt-form" class="form text-lg w-full">
|
||||||
<form id='form' hx-post="https://api.tfcconnection.org/camp-form" autocomplete="on" method="post" target="_parent" class="w-full items-center flex flex-wrap">
|
<form id='form' hx-post="http://localhost:4242/camp-form" hx-encoding="multipart/form-data" autocomplete="on" method="post" target="_parent" class="w-full items-center flex flex-wrap">
|
||||||
<h3 class="basis-full">Camp Form</h3>
|
<h3 class="basis-full">Camp Form</h3>
|
||||||
<div class="basis-full flex flex-wrap my-4">
|
<div class="basis-full flex flex-wrap my-4">
|
||||||
<label for="first-name" class="basis-full">What is your first and last name? <span class='inline-block text-[#f39] text-sm align-sub'>* required</span></label>
|
<label for="first-name" class="basis-full">What is your first and last name? <span class='inline-block text-[#f39] text-sm align-sub'>* required</span></label>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 563 KiB |
Binary file not shown.
Before Width: | Height: | Size: 188 KiB |
|
@ -1,9 +1,7 @@
|
||||||
use std::fs;
|
use actix_multipart::form::{text::Text, MultipartForm};
|
||||||
|
|
||||||
use actix_multipart::form::{tempfile::TempFile, text::Text, MultipartForm};
|
|
||||||
use actix_web::{post, HttpResponse};
|
use actix_web::{post, HttpResponse};
|
||||||
use lettre::{
|
use lettre::{
|
||||||
message::{header::ContentType, Attachment, MultiPart, SinglePart},
|
message::MultiPart,
|
||||||
transport::smtp::authentication::{Credentials, Mechanism},
|
transport::smtp::authentication::{Credentials, Mechanism},
|
||||||
Message, SmtpTransport, Transport,
|
Message, SmtpTransport, Transport,
|
||||||
};
|
};
|
||||||
|
@ -35,6 +33,7 @@ struct CampForm {
|
||||||
|
|
||||||
#[post("/camp-form")]
|
#[post("/camp-form")]
|
||||||
pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResponse {
|
pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResponse {
|
||||||
|
log::info!("a new form");
|
||||||
let first = form
|
let first = form
|
||||||
.first_name
|
.first_name
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -166,6 +165,7 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
||||||
})
|
})
|
||||||
.0
|
.0
|
||||||
.clone();
|
.clone();
|
||||||
|
let reg = registration.clone().as_str();
|
||||||
log::info!("{first} {last} signed up for camp!");
|
log::info!("{first} {last} signed up for camp!");
|
||||||
let email = markup::new! {
|
let email = markup::new! {
|
||||||
@markup::doctype()
|
@markup::doctype()
|
||||||
|
@ -282,5 +282,19 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
||||||
log::info!("Email incorrect");
|
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")
|
HttpResponse::Ok().body("thankyou")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue