summaryrefslogtreecommitdiffstats
path: root/templates/admin/user
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-05-26 11:42:54 +0200
committerGitHub <noreply@github.com>2023-05-26 09:42:54 +0000
commit85fa954a3810b233cb299f455546c4b2314400b3 (patch)
tree9cf4b3955c59b6c38aba1b1df07d14843aaef375 /templates/admin/user
parent18f26cfbf7f9b36b838c0e8762bfba98c89b9797 (diff)
downloadgitea-85fa954a3810b233cb299f455546c4b2314400b3.tar.gz
gitea-85fa954a3810b233cb299f455546c4b2314400b3.zip
Improve some Forms (#24878)
Don't really know a better name for this. I've gone through some Forms and added missing HTML attributes (mostly `maxlength`). I tried to fill the Forms with dummy Data and see if Gitea throws a Error (e.g. maximum length). If yes, I added the missing HTML attribute. While working on this, I discovered that the Form to add OAuth2 Apps just silently fails when filled with invalid data, so I fixed that too.
Diffstat (limited to 'templates/admin/user')
-rw-r--r--templates/admin/user/edit.tmpl12
-rw-r--r--templates/admin/user/new.tmpl2
2 files changed, 7 insertions, 7 deletions
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl
index 30109cc923..00d21f24b0 100644
--- a/templates/admin/user/edit.tmpl
+++ b/templates/admin/user/edit.tmpl
@@ -9,7 +9,7 @@
{{.CsrfTokenHtml}}
<div class="field {{if .Err_UserName}}error{{end}}">
<label for="user_name">{{.locale.Tr "username"}}</label>
- <input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal}}disabled{{end}}>
+ <input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal}}disabled{{end}} maxlength="40">
</div>
<!-- Types and name -->
<div class="inline required field {{if .Err_LoginType}}error{{end}}">
@@ -59,7 +59,7 @@
</div>
<div class="field {{if .Err_FullName}}error{{end}}">
<label for="full_name">{{.locale.Tr "settings.full_name"}}</label>
- <input id="full_name" name="full_name" value="{{.User.FullName}}">
+ <input id="full_name" name="full_name" value="{{.User.FullName}}" maxlength="100">
</div>
<div class="required field {{if .Err_Email}}error{{end}}">
<label for="email">{{.locale.Tr "email"}}</label>
@@ -72,18 +72,18 @@
</div>
<div class="field {{if .Err_Website}}error{{end}}">
<label for="website">{{.locale.Tr "settings.website"}}</label>
- <input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="e.g. http://mydomain.com or https://mydomain.com">
+ <input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="e.g. http://mydomain.com or https://mydomain.com" maxlength="255">
</div>
<div class="field {{if .Err_Location}}error{{end}}">
<label for="location">{{.locale.Tr "settings.location"}}</label>
- <input id="location" name="location" value="{{.User.Location}}">
+ <input id="location" name="location" value="{{.User.Location}}" maxlength="50">
</div>
<div class="ui divider"></div>
<div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}">
<label for="max_repo_creation">{{.locale.Tr "admin.users.max_repo_creation"}}</label>
- <input id="max_repo_creation" name="max_repo_creation" type="number" value="{{.User.MaxRepoCreation}}">
+ <input id="max_repo_creation" name="max_repo_creation" type="number" min="-1" value="{{.User.MaxRepoCreation}}">
<p class="help">{{.locale.Tr "admin.users.max_repo_creation_desc"}}</p>
</div>
@@ -181,7 +181,7 @@
<div class="inline field">
<label for="avatar">{{.locale.Tr "settings.choose_new_avatar"}}</label>
- <input name="avatar" type="file" >
+ <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp">
</div>
<div class="field">
diff --git a/templates/admin/user/new.tmpl b/templates/admin/user/new.tmpl
index dbf01fb43e..691d63aead 100644
--- a/templates/admin/user/new.tmpl
+++ b/templates/admin/user/new.tmpl
@@ -53,7 +53,7 @@
</div>
<div class="required field {{if .Err_UserName}}error{{end}}">
<label for="user_name">{{.locale.Tr "username"}}</label>
- <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required>
+ <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required maxlength="40">
</div>
<div class="required field {{if .Err_Email}}error{{end}}">
<label for="email">{{.locale.Tr "email"}}</label>