Skip to content

Commit

Permalink
limit username to 32 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub committed Oct 23, 2023
1 parent b2b637b commit 8559933
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/controller/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -860,7 +860,7 @@ pub(crate) async fn signin_post(Form(input): Form<FormSignin>) -> 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,
Expand Down
2 changes: 1 addition & 1 deletion templates/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="field">
<div class="control has-icons-left">
<input name="username" class="input" type="text" pattern="^\D.*" title="Username, Not start with number, 1 - 64 chars" required placeholder="Username, Not start with number, 1 - 64 chars" minlength="1" maxlength="64">
<input name="username" class="input" type="text" pattern="^\D.*" title="Username, Not start with number, 1 - 32 chars" required placeholder="Username, Not start with number, 1 - 64 chars" minlength="1" maxlength="32">
<span class="icon is-left">👤</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/user_setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="field-body">
<div class="field">
<div class="control">
<input name="username" class="input" type="text" pattern="^\D.*" required maxlength="64" value="{{username}}" placeholder="Username, Not start with number, 2 - 10 chars">
<input name="username" class="input" type="text" pattern="^\D.*" required maxlength="32" value="{{username}}" placeholder="Username, Not start with number, 2 - 10 chars">
</div>
</div>
</div>
Expand Down

0 comments on commit 8559933

Please sign in to comment.