J4 Issue ?
avatar roland-d
roland-d
5 Aug 2020

Steps to reproduce the issue

  1. Open your favourite database editor
  2. Open the table #__extensions
  3. Filter the list on name = 'com_users'
  4. Copy-paste the content of the params column into your favourite editor
  5. Checkout the 4.0-dev branch
  6. Run npm install
  7. Login to backend
  8. Go to Users -> Manage
  9. Click on the Options
  10. Open tab Password options
  11. Set Minimum Length to 4 by typing in 4 into the field
  12. Click on Save
  13. See the Success message and the Minimum Length changed back to 12
    image
  14. Go back to your database editor
  15. Reload the table
  16. See that the params column is empty. Your settings have been wiped.

Expected result

An error that the minimum length must be at least 12

Actual result

A success message and my settings wiped

System information (as much as possible)

Joomla 4.0 git checkout

Additional comments

This is caused by several issues:

  1. * The validate method enqueued all messages for us, so we just need to redirect back.

    On this line it false states that the messages are enqueued by the validate method. The validate method doesn't queue messages.
  2. $this->setRedirect(Route::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false));

    On this line we set the redirect but we don't actually perform the redirect so it continues saving the result. The result is actually false. This causes the data wiping.
avatar roland-d roland-d - open - 5 Aug 2020
avatar joomla-cms-bot joomla-cms-bot - change - 5 Aug 2020
Labels Added: J4 Issue ? ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Aug 2020
avatar roland-d roland-d - change - 5 Aug 2020
The description was changed
avatar roland-d roland-d - edited - 5 Aug 2020
avatar brianteeman
brianteeman - comment - 5 Aug 2020

An error that the minimum length must be at least 12

Why would that be expected?

avatar brianteeman
brianteeman - comment - 5 Aug 2020

Ah I see the problem

		<field
			name="minimum_length"
			type="number"
			label="COM_USERS_CONFIG_FIELD_MINIMUM_PASSWORD_LENGTH"
			min="8"
			step="1"
			default="12"
			validate="number"
		/>

The min of 8 only applies to the up/down arrows on the field and you can still type 4
The validation is only that its a number and not that it 8 or more

avatar brianteeman
brianteeman - comment - 5 Aug 2020

The same error happens on other fields which have a maximum value and you type a value greater than that

avatar roland-d
roland-d - comment - 5 Aug 2020

This was just a "lucky" find. The real issue is the failing of the form validation causing the system to store an empty value in the params field. Combined with a success message, a user may think that all is dandy.

avatar chmst
chmst - comment - 16 Aug 2020

I am in doubt about accessibility of this kind of input field. Why not use the dropdowns?


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

avatar roland-d
roland-d - comment - 16 Aug 2020

@chmst That is another discussion and not relevant to this issue. This behavior can be found with any configuration option that fails form validation. I am just using this one as it shows how to reproduce the issue.

avatar Bakual
Bakual - comment - 16 Aug 2020

I am in doubt about accessibility of this kind of input field. Why not use the dropdowns?

It's a native HTML5 element, nothing we invented ourself. I wouldn't expect accessibility issues with that by itself.

avatar richard67
richard67 - comment - 17 Aug 2020
   On this line we set the redirect but we don't actually perform the redirect so it continues saving the result. The result is actually false. This causes the data wiping.

@roland-d Can it be there is just a return false; missing after the $this->setRedirect(...);? I've had a similar issue at another place in past and fixed it that way.

P.S.: Same at other places, e.g. if we catch an exception when writing fails.

avatar roland-d
roland-d - comment - 17 Aug 2020

@richard67 As far as I saw, we need to redirect at this point but just adding that is not enough because there are no messages queued.

avatar SharkyKZ
SharkyKZ - comment - 18 Aug 2020

Use $model->getError() to get the message. Although there are some other issues like not storing/loading values from user state after validation fails.

avatar SharkyKZ SharkyKZ - change - 16 Oct 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-10-16 08:11:19
Closed_By SharkyKZ
Labels Added: ?
Removed: ?
avatar SharkyKZ
SharkyKZ - comment - 16 Oct 2020

Please test PR #31105.

avatar SharkyKZ SharkyKZ - close - 16 Oct 2020
avatar wilsonge wilsonge - change - 18 Dec 2020
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 18 Dec 2020

Add a Comment

Login with GitHub to post a comment