Task #8731

Meaninful messages in setup controller

Added by Christian Müller about 5 years ago. Updated almost 3 years ago.

Status:Resolved Start date:2010-07-07
Priority:Should have Due date:
Assigned To:Robert Lemke % Done:

100%

Category:-
Target version:-

Description

In case of not providing information (username & password) to create admin account some generic error message is thrown.

phoenix_task_8731.patch Magnifier - the patch to be applied to: /TYPO3v5/Distributions/Base/trunk/ (4 kB) Christian Müller, 2010-07-07 21:54

issue_8731.png - screenshot of messages (21.8 kB) Christian Müller, 2010-07-07 22:00


Related issues

related to TYPO3.Neos - Task #8734: Clean up SetupController and its resources Resolved 2010-07-08

History

#1 Updated by Christian Müller about 5 years ago

Ok, wasn't as easy as I thought.

First thing is the person argument, it won't validate if the name fields are not set and as I didn't find any (easy) way to intercept the validation error and give something nice instead, I set @dontvalidate and check it myself. The person requires a name to validate (which I don't like) so I check if at least one of the two fields is set. Finally that means that you need to fill at least three fields.

At least for me the current redirect in SVN version with: $this->redirect('index', 'Frontend\Page');
didn't work at all, so I changed to a (more dirty) but working: $this->redirectToUri('');

You can at maximum get two "error/info" messages:
  • To create the administrator account you must enter an username and a password.
  • Please provide at least first name or last name for the administrator account.

Both messages are to be found in F3\TYPO3\Controller\Backend\SetupController->importAndCreateAdministratorAction()

They are output as flashMessage and styled by the inline styles (no stylsheet included and already some inline styles...) in Setup Layout.

#2 Updated by Christian Müller about 5 years ago

A screenhot especially for Berit... Here are both messages you can get in FF 3.6

Styles are found in: trunk\Packages\Application\TYPO3\Resources\Private\Layouts\Setup.html
I added some for the messages in my patch.

#3 Updated by Sebastian Kurfuerst about 5 years ago

  • Status changed from New to Needs Feedback

Hey Christian,

thanks for working on this issue.

First thing is the person argument, it won't validate if the name fields are not set and as I didn't find any (easy) way to intercept the validation error and give something nice instead, I set @dontvalidate and check it myself. The person requires a name to validate (which I don't like) so I check if at least one of the two fields is set. Finally that means that you need to fill at least three fields.

for the createAdministrator() method, you do not need @dontvalidate annotations, as it is not an action.

At least for me the current redirect in SVN version with: $this->redirect('index', 'Frontend\Page');
didn't work at all, so I changed to a (more dirty) but working: $this->redirectToUri('');

This needs to be changed back, and we need to investigate the real error for this. $this->redirectToUri() can also break, specifically if you run TYPO3 in a subfolder.

Could you please provide information what your URI to the setup controller is, and the URI which is being redirected to?

You can at maximum get two "error/info" messages:
  • To create the administrator account you must enter an username and a password.
  • Please provide at least first name or last name for the administrator account.

Very nice.

In general, the solution with the "@dontvalidate" annotation and doing the validation yourself feels a bit hacky, but as long as the error messaging system is still not good, I think it's a good workaround.

Thanks again for working on this issue!

Greets,
Sebastian

#4 Updated by Christian Müller about 5 years ago

Yep I know its hacky, but I guess I just missed the way to catch a validation error for an object passed to an action. The problem is, that the = NULL notation in the method arguments doesn't help at all, because the Person object is created anyway even if you don't fill the fields, but in that case the object is not validated because name is empty and so the errorAction is called. I could overwrite the errorAction in the setup controller, but then I would need to check for all possible errors of all actions in this controller. If that is the way it is thought to be, then I would change it that way.

$this->redirectToUri() prepends the baseUri it gets from the request, so that should be quite safe, but I don't like it either. I guess the redirect to frontend fails because first the method is called show (which I tried too) and second it needs a page as argument...
My local Uri to setup is http://127.0.0.1:81/typo3/setup
For $this->redirect('index', 'Frontend\Page') it redirects to: http://127.0.0.1:81/typo3/frontend\page/index (note the backslash, it is no typo ;-) )

#5 Updated by Robert Lemke about 5 years ago

  • Assigned To set to Robert Lemke

Christian, thank you for your work!

After trying it out and looking through the remaining code of the SetupController I decided to clean it up a little. I'm afraid that your patch is a bit too hacky as it circumvents the FLOW3 validation mechanism.

I just committed an implementation which does use the FLOW3 API for displaying validation errors - it's not really polished but it's basically working.

During the next sprint we'll have to clean this up more thoroughly and also discuss possible improvements for the MVC error handling and validation messages.

#6 Updated by Robert Lemke about 5 years ago

  • Status changed from Needs Feedback to Resolved

#7 Updated by Robert Lemke about 5 years ago

  • % Done changed from 0 to 100

#8 Updated by Robert Lemke about 4 years ago

  • Project changed from Core Team to Base Distribution
  • Category deleted (User Interface)
  • Target version deleted (550)

#9 Updated by Robert Lemke almost 3 years ago

  • Project changed from Base Distribution to TYPO3.Neos

Also available in: Atom PDF