Fix max length check and limit in multiple repo forms (#9148)

* Fix input field max length for release, label and milestone forms

* Add max length for isseu and PR title
This commit is contained in:
Lauris BH 2019-11-25 01:06:23 +02:00 committed by GitHub
parent e8241bf55e
commit 95c3dc856a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 15 deletions

View File

@ -507,9 +507,9 @@ func (f SubmitReviewForm) HasEmptyContent() bool {
// NewReleaseForm form for creating release // NewReleaseForm form for creating release
type NewReleaseForm struct { type NewReleaseForm struct {
TagName string `binding:"Required;GitRefName"` TagName string `binding:"Required;GitRefName;MaxSize(255)"`
Target string `form:"tag_target" binding:"Required"` Target string `form:"tag_target" binding:"Required;MaxSize(255)"`
Title string `binding:"Required"` Title string `binding:"Required;MaxSize(255)"`
Content string Content string
Draft string Draft string
Prerelease bool Prerelease bool
@ -523,7 +523,7 @@ func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
// EditReleaseForm form for changing release // EditReleaseForm form for changing release
type EditReleaseForm struct { type EditReleaseForm struct {
Title string `form:"title" binding:"Required"` Title string `form:"title" binding:"Required;MaxSize(255)"`
Content string `form:"content"` Content string `form:"content"`
Draft string `form:"draft"` Draft string `form:"draft"`
Prerelease bool `form:"prerelease"` Prerelease bool `form:"prerelease"`

View File

@ -17,16 +17,16 @@
<div class="ui grid"> <div class="ui grid">
<div class="three wide column"> <div class="three wide column">
<div class="ui small input"> <div class="ui small input">
<input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required> <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50">
</div> </div>
</div> </div>
<div class="five wide column"> <div class="five wide column">
<div class="ui small fluid input"> <div class="ui small fluid input">
<input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}"> <input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200">
</div> </div>
</div> </div>
<div class="color picker column"> <div class="color picker column">
<input class="color-picker" name="color" value="#70c24a" required> <input class="color-picker" name="color" value="#70c24a" required maxlength="7">
</div> </div>
<div class="column precolors"> <div class="column precolors">
{{template "repo/issue/label_precolors"}} {{template "repo/issue/label_precolors"}}
@ -151,16 +151,16 @@
<div class="ui grid"> <div class="ui grid">
<div class="three wide column"> <div class="three wide column">
<div class="ui small input"> <div class="ui small input">
<input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required> <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50">
</div> </div>
</div> </div>
<div class="five wide column"> <div class="five wide column">
<div class="ui small fluid input"> <div class="ui small fluid input">
<input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}"> <input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200">
</div> </div>
</div> </div>
<div class="color picker column"> <div class="color picker column">
<input class="color-picker" name="color" value="#70c24a" required> <input class="color-picker" name="color" value="#70c24a" required maxlength="7">
</div> </div>
<div class="column precolors"> <div class="column precolors">
{{template "repo/issue/label_precolors"}} {{template "repo/issue/label_precolors"}}

View File

@ -26,7 +26,7 @@
<div class="eleven wide column"> <div class="eleven wide column">
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">
<label>{{.i18n.Tr "repo.milestones.title"}}</label> <label>{{.i18n.Tr "repo.milestones.title"}}</label>
<input name="title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" autofocus required> <input name="title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" autofocus required maxlength="50">
</div> </div>
<div class="field"> <div class="field">
<label>{{.i18n.Tr "repo.milestones.desc"}}</label> <label>{{.i18n.Tr "repo.milestones.desc"}}</label>

View File

@ -13,7 +13,7 @@
</a> </a>
<div class="ui segment content"> <div class="ui segment content">
<div class="field"> <div class="field">
<input name="title" id="issue_title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" tabindex="3" autofocus required> <input name="title" id="issue_title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" tabindex="3" autofocus required maxlength="255">
{{if .PageIsComparePull}} {{if .PageIsComparePull}}
<div class="title_wip_desc">{{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div> <div class="title_wip_desc">{{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div>
{{end}} {{end}}

View File

@ -3,7 +3,7 @@
<h1 class="twelve wide column"> <h1 class="twelve wide column">
<span class="index">#{{.Issue.Index}}</span> <span id="issue-title" class="has-emoji">{{.Issue.Title}}</span> <span class="index">#{{.Issue.Index}}</span> <span id="issue-title" class="has-emoji">{{.Issue.Title}}</span>
<div id="edit-title-input" class="ui input" style="display: none"> <div id="edit-title-input" class="ui input" style="display: none">
<input value="{{.Issue.Title}}"> <input value="{{.Issue.Title}}" maxlength="255">
</div> </div>
</h1> </h1>
{{if and (or .IsIssueWriter .IsIssuePoster) (not .Repository.IsArchived)}} {{if and (or .IsIssueWriter .IsIssuePoster) (not .Repository.IsArchived)}}

View File

@ -19,7 +19,7 @@
{{if .PageIsEditRelease}} {{if .PageIsEditRelease}}
<b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong> <b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong>
{{else}} {{else}}
<input id="tag-name" name="tag_name" value="{{.tag_name}}" placeholder="{{.i18n.Tr "repo.release.tag_name"}}" autofocus required> <input id="tag-name" name="tag_name" value="{{.tag_name}}" placeholder="{{.i18n.Tr "repo.release.tag_name"}}" autofocus required maxlength="255">
<span class="at">@</span> <span class="at">@</span>
<div class="ui selection dropdown"> <div class="ui selection dropdown">
<input type="hidden" name="tag_target" value="{{.tag_target}}"/> <input type="hidden" name="tag_target" value="{{.tag_target}}"/>
@ -42,7 +42,7 @@
<div class="eleven wide column"> <div class="eleven wide column">
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">
<label>{{.i18n.Tr "repo.release.title"}}</label> <label>{{.i18n.Tr "repo.release.title"}}</label>
<input name="title" placeholder="{{.i18n.Tr "repo.release.title"}}" value="{{.title}}" autofocus required> <input name="title" placeholder="{{.i18n.Tr "repo.release.title"}}" value="{{.title}}" autofocus required maxlength="255">
</div> </div>
<div class="field"> <div class="field">
<label>{{.i18n.Tr "repo.release.content"}}</label> <label>{{.i18n.Tr "repo.release.content"}}</label>