From 8559933106a471afd55070a91af079d1d3a30e7f Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 23 Oct 2023 23:52:35 +0800 Subject: [PATCH] limit username to 32 chars --- Cargo.lock | 16 ++++++++-------- src/controller/user.rs | 4 ++-- templates/signup.html | 2 +- templates/user_setting.html | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38053b0..6b04d07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,9 +282,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "basic-toml" @@ -1026,7 +1026,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "headers-core", "http", @@ -1516,9 +1516,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -2091,7 +2091,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -2226,7 +2226,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", ] [[package]] @@ -2572,7 +2572,7 @@ dependencies = [ "aho-corasick", "arc-swap", "async-trait", - "base64 0.21.4", + "base64 0.21.5", "bitpacking", "byteorder", "census", diff --git a/src/controller/user.rs b/src/controller/user.rs index 9a744b3..6535201 100644 --- a/src/controller/user.rs +++ b/src/controller/user.rs @@ -583,7 +583,7 @@ pub(crate) async fn role_post( /// Form data: `/user/setting` #[derive(Deserialize, Validate)] pub(crate) struct FormUser { - #[validate(length(min = 1, max = 64))] + #[validate(length(min = 1, max = 32))] username: String, #[validate(length(max = 1024))] about: String, @@ -860,7 +860,7 @@ pub(crate) async fn signin_post(Form(input): Form) -> impl IntoRespo /// Form data: `/signup` #[derive(Deserialize, Validate)] pub(crate) struct FormSignup { - #[validate(length(min = 1, max = 64))] + #[validate(length(min = 1, max = 32))] username: String, #[validate(must_match(other = "password2", message = "Two passwords do not match"))] password: String, diff --git a/templates/signup.html b/templates/signup.html index 052f2b1..066dbd0 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -16,7 +16,7 @@
- + 👤
diff --git a/templates/user_setting.html b/templates/user_setting.html index 593ee90..ff9059d 100644 --- a/templates/user_setting.html +++ b/templates/user_setting.html @@ -35,7 +35,7 @@
- +