Bug #75220
closed
Added by Antoine Bouet over 8 years ago.
Updated about 6 years ago.
Description
Hi :)
I have a strange behaviour with FE Users.
When I log with the last created FE User, the prefilled personal datas of my user forms are the one of another FE User.
Here is my code :
$user = $GLOBALS['TSFE']->fe_user->user;
if ($user) {
$this->frontendUser = $this->frontendUserRepository->findByUid($user['uid']);
}
$this->view->assignMultiple(
array(
'feUser' => $this->frontendUser
)
);
If I change the usergroup to another FE Group, the datas are ok.
Then if I change the usergroup to the original FE Group, the datas are wrong.
When I try to display a debug of $this->frontendUser, all is fine, there is no problem anymore ...
Tested in several browser and private modes.
Any ideas ?
- Status changed from New to Needs Feedback
- Assignee set to Mathias Schreiber
Guess:
Your output is cached with the data of the previously logged in user?
My test was this one :
I logged with the FE User : uid 128 (the last created)
It displayed the datas of the FE User : uid 64 (they have the same usergroup)
I didn't log before with the user 64.
I received some other feedbacks of web users : they saw the datas of the same FE User : always the last user (128)
This is the same behaviour with private mode and different browser, so it's not cached in the browser.
I know that's a weird behaviour, that the first time I see this :(
it's cached by TYPO3.
How do you display the user data?
With an own Content Element?
In my newAction function, assignMultiple send $this->frontendUser to a form.
$this->view->assignMultiple(
array(
'feUser' => $this->frontendUser
)
);
In Templates :
<f:layout name="Default" />
<f:section name="main">
<f:render partial="FormErrors" arguments="{object:Ideas}" />
<f:form action="create" enctype="multipart/form-data" name="newIdeas" object="{newIdeas}">
<f:render partial="Ideas/FormFields" arguments="{_all}" />
</f:form>
</f:section>
In the Partial :
<fieldset class="form_item">
<div class="content_form_item">
<div class="ligne_form">
<f:form.textfield property="title" id="title" required="required" />
</div>
<div class="ligne_form">
<f:form.textfield property="name" id="name" value="{feUser.name}" />
</div>
<div class="ligne_form">
<f:form.textarea property="address" id="address" value="{feUser.address}" cols="40" rows="10" />
</div>
<div class="ligne_form">
<f:form.textfield property="email" id="email" value="{feUser.email}" required="required" />
</div>
<div class="ligne_form">
<f:form.textfield property="telephone" id="telephone" value="{feUser.telephone}" />
</div>
<div class="ligne_form btn_submit">
<f:form.submit value="Send" id="idea_submit" />
</div>
</div>
</fieldset>
In my newAction function, assignMultiple send $this->frontendUser to a form.
When this is the case, it is mandatory for the action you call to be configured as an uncached controller action in your Extbase plugin configuration. The only time that this rule doesn't apply is when POST'ing to an action, in which case it always is not cached regardless of configuration.
Alternatively but against the rules and expectations: force no_cache on TSFE in your controller action.
Thank you for your answer, it seems to work :)
I used to "uncache" only the create and update action, I didn't know this kind of problems.
You can close this issue :)
- Status changed from Needs Feedback to Resolved
- Status changed from Resolved to Closed
Also available in: Atom
PDF