Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to POST form validation #4623

Merged
merged 3 commits into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/main/resources/lib/form/combobox.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ THE SOFTWARE.
<st:attribute name="field">
Used for databinding.
</st:attribute>
<st:attribute name="checkUrl">
If specified, the value entered in this input field will be checked (via AJAX)
against this URL, and errors will be rendered under the text field.

If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.TODO.
</st:attribute>
</st:documentation>
<f:prepareDatabinding/>
${descriptor.calcFillSettings(field,attrs)} <!-- this figures out the 'fillUrl' and 'fillDependsOn' attribute -->
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/number.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ THE SOFTWARE.
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'post' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a GET to a POST.
If any other value is specified then requests will use GET.
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.TODO.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/resources/lib/form/password.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ THE SOFTWARE.
If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'post' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a GET to a POST.
If any other value is specified then requests will use GET.
</st:attribute>
</st:documentation>
<f:prepareDatabinding/>
<j:set var="resolvedValue" value="${attrs.value ?: instance[attrs.field]}" />
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/select.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ THE SOFTWARE.
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'post' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a GET to a POST.
If any other value is specified then requests will use GET.
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.TODO.
</st:attribute>
</st:documentation>

Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/textarea.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ THE SOFTWARE.
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'post' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a GET to a POST.
If any other value is specified then requests will use GET.
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.TODO.
</st:attribute>
<st:attribute name="codemirror-mode">
Turns this text area into CodeMirror-assisted code editing text area.
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/textbox.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ THE SOFTWARE.
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'post' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a GET to a POST.
If any other value is specified then requests will use GET.
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.TODO.
</st:attribute>
<st:attribute name="autoCompleteDelimChar">
A single character that can be used as a delimiter for autocompletion. Normal
Expand Down
4 changes: 2 additions & 2 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ var FormChecker = {
},

sendRequest : function(url, params) {
if (params.method == "post") {
if (params.method != "get") {
var idx = url.indexOf('?');
params.parameters = url.substring(idx + 1);
url = url.substring(0, idx);
Expand Down Expand Up @@ -531,7 +531,7 @@ function registerValidator(e) {
return url+ q.toString();
}
};
var method = e.getAttribute("checkMethod") || "get";
var method = e.getAttribute("checkMethod") || "post";

var url = e.targetUrl();
try {
Expand Down