Project

General

Profile

Actions

Bug #75220

closed

Wrong FE User datas

Added by Antoine Bouet over 8 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Category:
Frontend
Target version:
-
Start date:
2016-03-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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 ?

Actions #1

Updated by Mathias Schreiber over 8 years ago

  • 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?

Actions #2

Updated by Antoine Bouet over 8 years ago

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 :(

Actions #3

Updated by Mathias Schreiber over 8 years ago

it's cached by TYPO3.

How do you display the user data?
With an own Content Element?

Actions #4

Updated by Antoine Bouet over 8 years ago

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>

Actions #5

Updated by Claus Due over 8 years ago

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.

Actions #6

Updated by Antoine Bouet over 8 years ago

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 :)

Actions #7

Updated by Mathias Schreiber over 8 years ago

  • Status changed from Needs Feedback to Resolved
Actions #8

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF