? ? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
23 Dec 2017

Pull Request for Issue # .

Summary of Changes

When someone register for an account and registration is failed for some reasons (for example, use an existing username or existing email), users will be redirected back to registration form with error messages explain the reason of errors. However, the data which he entered before is lost and he will have to re-enter again to register for an account. This PR fixes that issue

Testing Instructions

  1. Install Joomla

  2. Try to register for an account, use an existing username

  3. Before patch, you will be redirected back to register form. However, the data you entered before is cleared

  4. After patch, you will be redirected back tor registration form, but the data you entered before is kept

Technical explanation

For some reasons, the UsersViewRegistration class defines $data property (although I could not see it is used anywhere). When this line of code is called https://github.com/joomla/joomla-cms/blob/staging/components/com_users/views/registration/view.html.php#L41, the method getData of UsersModelRegistration is called. A form is created and cached without loading data from session https://github.com/joomla/joomla-cms/blob/staging/components/com_users/models/registration.php#L247

Later, when this command is called to get form object for view https://github.com/joomla/joomla-cms/blob/staging/components/com_users/views/registration/view.html.php#L42, the system uses the blank cached form and that's the reason form data is lost

As $data property is not used anywhere, I just remove it and remove$this->data = $this->get('Data'); calls, it is now working as expected

avatar joomdonation joomdonation - open - 23 Dec 2017
avatar joomdonation joomdonation - change - 23 Dec 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Dec 2017
Category Front End com_users
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 23 Dec 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 Dec 2017

I have tested this item successfully on d36f981


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

avatar alikon alikon - test_item - 23 Dec 2017 - Tested successfully
avatar alikon
alikon - comment - 23 Dec 2017

I have tested this item successfully on d36f981


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

avatar franz-wohlkoenig franz-wohlkoenig - change - 23 Dec 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 Dec 2017

Ready to Commit after two successful tests.

avatar sandewt
sandewt - comment - 14 Jan 2018

I have performed a successful test. But...

If you leave after a failed registration attempt the registration page and you come back again,
then you would expect that the (confidential) data would have disappeared.
That is not the case right now. !!!
Is that the intention?

avatar joomdonation
joomdonation - comment - 15 Jan 2018

@sandewt Yes, that is the way how Joomla handles submitted form data. When there is a validation errors and data could not be saved, Joomla will stores the form data in session and then redirect users back to the previous page so that users can correct the wrong data

As the data stored in session, if you leave the page and access again later, the data will still be there. It will be erased when session expired. Also, just want to make it clear that only you see that data on your own computer, other users won't see it.

avatar sandewt
sandewt - comment - 15 Jan 2018

Hi @joomdonation, do not get me wrong.

I think it's a big improvement.

The mechanism is known to me.

On closer inspection, see also issue #17743 (Contact form loses data), there is the same thing.


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

avatar joomdonation
joomdonation - comment - 15 Jan 2018

@sandewt So do you think there is any problem with this PR ? Or it is fine?

avatar sandewt
sandewt - comment - 15 Jan 2018

Hi @joomdonation, there is NO problem with this PR.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19145.
avatar mbabker
mbabker - comment - 15 Jan 2018

I keep going back and forth on this because there is technically a B/C break here by removing the data property (since component layouts are in scope of the view class, the property is accessible to layouts). My gut says if this is to be merged it should go into 3.9 with the note of the potential (albeit highly unlikely) B/C break, and not included in a patch release.

avatar joomdonation
joomdonation - comment - 15 Jan 2018

Strange that someone introduced this property without any usage in the core. A workaround to fix this issue without B/C is change ordering of method call to:

$this->form   = $this->get('Form');
$this->data   = $this->get('Data');

Please let me know if that's OK and I will make this change to have the issue fixed. It is not nice to have to re-enter data when validation failed.

avatar joomdonation joomdonation - change - 15 Jan 2018
Labels Added: ?
avatar sandewt sandewt - test_item - 16 Jan 2018 - Tested successfully
avatar sandewt
sandewt - comment - 16 Jan 2018

I have tested this item successfully on 6f7f256


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

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 16 Jan 2018 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 16 Jan 2018

I have tested this item successfully on 6f7f256


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

avatar mbabker mbabker - change - 16 Jan 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-01-16 22:39:20
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 16 Jan 2018
avatar mbabker mbabker - merge - 16 Jan 2018

Add a Comment

Login with GitHub to post a comment