? ? Pending

User tests: Successful: Unsuccessful:

avatar jo-sf
jo-sf
6 Aug 2016

Currently you can enter nearly everything into the TCP port configuration fields both in the global configuration and the configuration for the LDAP authentication plugin. These fields should accept only valid numbers in the range of 1 through 65535, they should have a reasonable default value if applicable and it should be possible to leave them empty if they are not required.

Initially this PR was an add-on PR for PR #11322 but since that other PR was closed in the meantime and the author suggested that someone else might continue I merged the changes from PR #11322 into this PR and added the configuration for the LDAP authentication plugin since it also contains a TCP port field.

Testing Instructions

Status Quo

  • Open in the Joomla administration the global configuration form and select the "Server" tab
  • Enable FTP such that the "FTP Port" field is shown
  • Enter any text, e.g. "foo", into that field and press the "Save" button
  • Check the value for the "$ftp_port" variable in configuration.php, it should be "foo"
  • Check the value in the global configuration form, it should be "foo" too
  • Clear the "FTP Port" field and press the "Save" button
  • Now the "$ftp_port" variable in configuration.php and the "FTP Port" field should be empty again
  • Enable Proxy such that the "Proxy Port" field is shown
  • Repeat the above tests, the variable to check in configuration.php is "$proxy_port"
  • Disable Proxy after these tests
  • Enable sending mails if not enabled
  • Switch the mailer to "SMTP" such that the "SMTP Port" field is shown
  • Replace the value (probably "25") with any text, e.g. "bar" and press the "Save" button
  • Check the value for the "$smtpport" variable in configuration.php, it should be "bar"
  • Check the value in the global configuration form, it should be "bar" too
  • Clear the "SMTP Port" field (when doing so the border should become red) and try to save the form
  • The form is not saved, you have to enter a value in the "SMTP Port" field
  • Enter the value found there initially (probably "25") into the field and press the "Save" button
  • Saving should work now, check in the configuration.php file and in the global configuration form
  • Leave the global configuration form by means of the "Save & Close" button
  • Open Extensions -> Plugins and locate the "Authentication - LDAP" plugin
  • Open the configuration for this plugin and locate the "Port" field
  • The content in this field is probably "389"
  • Repeat the above tests with the "Port" field
  • Note that when you clear the field the default value "389" is automatically filled in
  • Leave the plgin configuration by means of the "Save & Close" button

Change

  • Now install this PR
  • Check configuration.php: "$ftp_port" and "proxy_port" should be empty and "$smtpport" should be set
  • Open in the Joomla administration the global configuration form and select the "Server" tab
  • Enable FTP such that the "FTP Port" field is shown
  • The field "FTP Port" should now look different, it contains the hint "21" you can increase and decrease the current value by clicking the "up" and "down" arrows at the right side of the field
  • Enter any text, e.g. "foo", into that field, the border of the field is shown in red as long as the cursor is in that field
  • Press the "Save" button
  • Next you'll get a success message and the field again contains the hint "21"
  • Check configuration.php: "$ftp_port" is still empty
  • This behaviour is as expected: the browser doesn't send illegal values to the server, and since the "FTP Port" field is declared as numeric and the value "foo" is no number the browser sends an empty field to the server
  • Enter an invalid port number in the "FTP Port" field, e.g. "99999" and press the "Save" button
  • You'll get an error message because the value is not allowed, the "$ftp_port" variable in configuration.php has not been changed
  • Enter a valid port number in the "FTP Port" field, e.g. "21" and press the "Save" button
  • Check configuration.php: "$ftp_port" is now "21"
  • The value "21" is also shown in the "FTP Port" field
  • Clear the "FTP Port" field and press the "Save" button
  • Enable Proxy such that the "Proxy Port" field is shown
  • Repeat the above tests, the variable to check in configuration.php is "$proxy_port"
  • Disable Proxy after these tests
  • Repeat the above tests with the "SMTP Port" field, in doing so note that this field is required -> you must enter a valid number, e.g. "25" into that field
  • Leave the global configuration form by means of the "Save & Close" button
  • Open Extensions -> Plugins and locate the "Authentication - LDAP" plugin
  • Open the configuration for this plugin and locate the "Port" field
  • The content in this field is probably "389"
  • Repeat the above tests with the "Port" field
  • Note that when you clear the field the default value "389" is automatically filled in
  • Leave the plgin configuration by means of the "Save & Close" button

Recipe for defining numeric fields

Currently most fields that shall accept only numeric values are defined as follows:

<field
        name="..."
        type="text"
        label="..."
        description="..."
        default="..."
        filter="integer"
        size="5"
/>

The "default" attribute might be missing if it is not appropriate for a field, the filter type given is sometimes "string" instead of "integer" and the "size" attribute sometimes has other values, e.g. "8".

When converting such a field into a truly numeric field (a field where the browser knows that it is numeric) one of the two following formats should be used.

Format (a) with a default value:

<field
        name="..."
        type="number"
        label="..."
        description="..."
        min="1"
        max="65535"
        default="..."
        validate="number"
        filter="integer"
        size="5"
/>

Format (b) without a default value, instead with a hint:

<field
        name="..."
        type="number"
        label="..."
        description="..."
        min="1"
        max="65535"
        hint="..."
        validate="number"
        filter="integer"
        size="5"
/>

Note that the "min" and "max" attributes are set in both formats appropriately for TCP port fields, change them as necessary for other purposes or remove either of them if not needed.

avatar joomla-cms-bot joomla-cms-bot - change - 6 Aug 2016
Category Libraries
avatar jo-sf jo-sf - open - 6 Aug 2016
avatar jo-sf jo-sf - change - 6 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Aug 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 9 Aug 2016
Category Libraries Libraries Unit Tests
avatar joomla-cms-bot joomla-cms-bot - change - 9 Aug 2016
Labels Added: ?
avatar jo-sf jo-sf - change - 8 Nov 2016
The description was changed
avatar joomla-cms-bot joomla-cms-bot - change - 8 Nov 2016
Category Libraries Unit Tests Layout Libraries Unit Tests
avatar Luchen6 Luchen6 - test_item - 9 Nov 2016 - Tested successfully
avatar Luchen6
Luchen6 - comment - 9 Nov 2016

I have tested this item successfully on e34a81e

Tested this successfully according to the instructions.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11492.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Jan 2017

I have tested this item ? unsuccessfully on e34a81e

Part "Status Quo": #11322: No Matching Results in Patchtester

With and without Patch Field FTP-Port is empty in global configuration and configuration.php. If Field is filled by 21 it's shown in both Places.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11492.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 10 Jan 2017 - Tested unsuccessfully
avatar zero-24
zero-24 - comment - 10 Jan 2017

@jo-sf as #11322 is closed can you fix the merge conflicts and confirm that it is still working even without the changes from #11322 ?

avatar jo-sf
jo-sf - comment - 12 Jan 2017

@franz-wohlkoenig @zero-24 I will resolve the merge conflicts asap and then I'll look for another test case since the test instructions given above will no longer work due to PR #11322 having been closed some days ago. My patch should work regardless of #11322 btw. As soon as both tasks (merging and finding a new test case) are complete I'll come back. Hope that's OK.

avatar jo-sf jo-sf - edited - 17 Jan 2017
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jan 2017
Category Libraries Unit Tests Layout Administration com_config Layout Libraries Front End Plugins Unit Tests
avatar jo-sf jo-sf - edited - 17 Jan 2017
avatar jo-sf
jo-sf - comment - 17 Jan 2017

@franz-wohlkoenig @zero-24 I searched for any other form field where this PR might be tested with but there seems to be none within Joomla.

Due to that and because the intention for PR #11322 is IMO good (help administrators in setting up a Joomla installation and try to prevent human errors as much as possible) I copied @andrepereiradasilva 's changes to my PR (hope that's OK @andrepereiradasilva ?). I also found another configuration form where a TCP port is to be configured (LDAP authentication plugin) and I changed that as well.

In checking and changing both XML files I tried to use the same layout (style) for all field definitions even if that resulted in more changed lines than absolutely necessary. It this is not desired I can undo this and only leave the changed field definitions.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Jan 2017

@jo-sf so no more test necessary?

avatar jo-sf
jo-sf - comment - 20 Jan 2017

@franz-wohlkoenig I don't think you want to merge my PR with the staging code without any successful human test... due to that I assume that someone or better two or more people should test this PR prior to deciding whether it should be merged with the staging code.

avatar jo-sf jo-sf - change - 20 Jan 2017
The description was changed
Title
Allow empty numeric fields if not required
Use type="number" in TCP port configuration fields
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Jan 2017

@jo-sf i can test using patchtester on latest nightly, i don't merge pr with staging code;-)

avatar jo-sf
jo-sf - comment - 20 Jan 2017

@franz-wohlkoenig yes please test with the latest nightly, and I hope it will work without problems.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 21 Jan 2017

I have tested this item successfully on 46594c7


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11492.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 21 Jan 2017 - Tested successfully
avatar zero-24
zero-24 - comment - 21 Jan 2017

I have tested this item ? unsuccessfully on 46594c7

There is no hint default value for the LDAP Plugin port and SMTP Port if that is fixed. (Should be just the hint attribute in the XML) this is read to merge.

Great work!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11492.

avatar zero-24 zero-24 - test_item - 21 Jan 2017 - Tested unsuccessfully
avatar jo-sf
jo-sf - comment - 22 Jan 2017

@zero-24 I added the hint attribute both to the LDAP port and the SMTP port fields.

My suggestion was however (see the recipe for defining numeric fields above) to have either the default or the hint attribute with numeric fields. The idea behind this was that the most common value is used as the default value and that the typical values for this field should be described in the field's description visible if you hover the field name. Both for the LDAP and the SMTP port fields there is no single typical value but the value to use depends upon other settings like the secure SMTP setting (ports can be 25, 465 or 587) or secure LDAP communication via TLS (ports can be 389 for unsecure communication and 636 for TLS secured communication).

Maybe the LDAP port field description should be changed accordingly as is already the case for the SMTP port field description. Currently the LDAP port field description only states that the default port is 389.

avatar zero-24
zero-24 - comment - 22 Jan 2017

I have tested this item successfully on 892d4df


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11492.

avatar zero-24 zero-24 - test_item - 22 Jan 2017 - Tested successfully
avatar zero-24 zero-24 - change - 22 Jan 2017
Milestone Added:
Status Pending Ready to Commit
Labels Added: ?
avatar zero-24
zero-24 - comment - 22 Jan 2017

RTC as after the successful test just cosmetical changes was made. Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11492.

avatar wilsonge wilsonge - change - 22 Jan 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-01-22 14:58:57
Closed_By wilsonge
Labels
avatar wilsonge wilsonge - close - 22 Jan 2017
avatar wilsonge wilsonge - merge - 22 Jan 2017
avatar wilsonge
wilsonge - comment - 22 Jan 2017

Merged - thanks!

Add a Comment

Login with GitHub to post a comment