This commit is contained in:
Joe Ardent 2023-05-28 17:06:09 -07:00
parent 0f0a7583cd
commit 559e277d9e
3 changed files with 11 additions and 66 deletions

7
Cargo.lock generated
View file

@ -1073,14 +1073,13 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.6" version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" checksum = "eebffdb73fe72e917997fad08bdbf31ac50b0fa91cec93e69a0662e4264d454c"
dependencies = [ dependencies = [
"libc", "libc",
"log",
"wasi", "wasi",
"windows-sys 0.45.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]

View file

@ -13,16 +13,16 @@ tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tower = { version = "0.4", features = ["util", "timeout"], default-features = false } tower = { version = "0.4", features = ["util", "timeout"], default-features = false }
tower-http = { version = "0.4", features = ["add-extension", "trace"] } tower-http = { version = "0.4", features = ["add-extension", "trace"] }
uuid = { version = "1.3", features = ["serde", "v4"] } uuid = { version = "1", features = ["serde", "v4"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
sqlx = { version = "0.6", default-features = false, features = ["runtime-tokio-rustls", "any", "sqlite", "chrono", "time", "uuid"] } sqlx = { version = "0.6", default-features = false, features = ["runtime-tokio-rustls", "any", "sqlite", "chrono", "time", "uuid"] }
argon2 = "0.5" argon2 = "0.5"
rand_core = { version = "0.6", features = ["getrandom"] } rand_core = { version = "0.6", features = ["getrandom"] }
thiserror = "1.0.40" thiserror = "1"
justerror = "1.1.0" justerror = "1"
password-hash = { version = "0.5.0", features = ["std", "getrandom"] } password-hash = { version = "0.5", features = ["std", "getrandom"] }
axum-login = { version = "0.5.0", features = ["sqlite", "sqlx"] } axum-login = { version = "0.5", features = ["sqlite", "sqlx"] }
unicode-segmentation = "1.10.1" unicode-segmentation = "1"
urlencoding = "2.1.2" urlencoding = "2"
async-session = "3.0.0" async-session = "3"

View file

@ -1,54 +0,0 @@
use axum::{extract::Form, response::Html};
use serde::Deserialize;
pub(crate) async fn show_form() -> Html<&'static str> {
Html(
r#"
<!doctype html>
<html>
<head></head>
<body>
<form action="/" method="post">
<label for="name">
Enter your name:
<input type="text" name="name">
</label>
<label>
Enter your email:
<input type="text" name="email">
</label>
<input type="submit" value="Subscribe!">
</form>
</body>
</html>
"#,
)
}
#[derive(Deserialize, Debug)]
#[allow(dead_code)]
pub(crate) struct Input {
name: String,
email: String,
}
pub(crate) async fn accept_form(Form(input): Form<Input>) -> Html<String> {
let Input { name, email: _ } = input;
let html = format!(
r#"
<!doctype html>
<html>
<head></head>
<body>
<p>Hi, {}</p>
</body>
</html>
"#,
name
);
Html(html)
}