[Flow] Login show Username

Carsten Bleicker carsten at bleicker.de
Tue Jan 6 17:01:30 CET 2015


I think you should not publish any kind of account data in you application
because the account identifier is a login credential.
you should use the party itself wich is a part of the security stuff.
inject the security context and get the party out of it to display the name f.e.

class Foo extends ActionController {

	/**
	 * @var \TYPO3\Flow\Security\Context
	 * @Flow\Inject
	 */
	protected $securityContext;

	public function indexAction(){
		$this->view->assign('party', $this->securityContext->getParty())
	}
}

----------------------

Carsten Bleicker
Wülfingstraße 1
42477 Radevormwald

E-Mail:	carsten at bleicker.de
Web:	www.bleicker.de
Twitter:	@carstenbleicker
Jabber:	cbleicker at jabber.ccc.de
Telefon:	+49 (0)171-2690845

Am 06.01.2015 um 16:47 schrieb Patric Eckhart <mail at patriceckhart.com>:

> I have created a actioncontroller to manage frontend user. the user can register and login.
> Now I would show the username in my template. I have tried the following function but I does not work.
> 
> {username} in my fluid template
> 
> /**
> 	 * @return \TYPO3\Flow\Security\Account
> 	 * @param string $identifier
> 	 * @return void
> 	 */
> 	public function indexAction() {
> 		$user = $this->account->getAccountIdentifier();
> 		$account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($user, "DefaultProvider");
> 		$this->view->assign('username', $account);
> 	}
> 
> Can you help me?
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow



More information about the Flow mailing list