jenkins-bot has submitted this change and it was merged.

Change subject: Trim fields before sending to server
......................................................................


Trim fields before sending to server

Makes the logs look nicer

Change-Id: Ie441283b6d05c840dd1bf6c6c08a5fc6df88877c
---
M modules/js/ext.donationInterface.forms.js
M worldpay_gateway/forms/js/esop.js
2 files changed, 11 insertions(+), 0 deletions(-)

Approvals:
  XenoRyet: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/js/ext.donationInterface.forms.js 
b/modules/js/ext.donationInterface.forms.js
index 9ca5fee..5ca9f1b 100644
--- a/modules/js/ext.donationInterface.forms.js
+++ b/modules/js/ext.donationInterface.forms.js
@@ -17,7 +17,15 @@
         */
        function submitForm() {
                di.forms.disable();
+               di.forms.clean();
                $( '#payment-form' )[ 0 ].submit();
+       }
+
+       function cleanInput() {
+               // Trim all the trimmable inputs
+               $( '[type=text], [type=number], [type=email]' ).each( function 
() {
+                       $( this ).val( $.trim( this.value ) );
+               } );
        }
 
        /**
@@ -27,6 +35,7 @@
         */
        function callDonateApi( successCallback ) {
                di.forms.disable();
+               di.forms.clean();
                $( '#paymentContinueBtn' ).removeClass( 'enabled' );
 
                var sendData = {
@@ -86,6 +95,7 @@
        di.forms = {
                disable: disableForm,
                enable: enableForm,
+               clean: cleanInput,
                // Gateways with more complex form submission can overwrite this
                // property with their own submission function.
                submit: submitForm,
diff --git a/worldpay_gateway/forms/js/esop.js 
b/worldpay_gateway/forms/js/esop.js
index b96d0e2..131b384 100644
--- a/worldpay_gateway/forms/js/esop.js
+++ b/worldpay_gateway/forms/js/esop.js
@@ -6,6 +6,7 @@
                        return;
                }
                di.forms.disable();
+               di.forms.clean();
                $( '#paymentContinueBtn' ).removeClass( 'enabled' );
 
                var postdata = {

-- 
To view, visit https://gerrit.wikimedia.org/r/291154
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie441283b6d05c840dd1bf6c6c08a5fc6df88877c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to