Security.ifAuthenticated ViewHelper <f:security.ifAuthenticated>

This ViewHelper implements an ifAuthenticated/else condition for frontend users.

Examples

Basic usage

<f:security.ifAuthenticated>
   This is being shown whenever a FE user is logged in
</f:security.ifAuthenticated>
Copied!

Everything inside the <f:security.ifAuthenticated> tag is being displayed if current frontend user is authenticated.

IfAuthenticated / then / else

<f:security.ifAuthenticated>
   <f:then>
      This is being shown in case you have access.
   </f:then>
   <f:else>
      This is being displayed in case you do not have access.
   </f:else>
</f:security.ifAuthenticated>
Copied!

Everything inside the <f:then></f:then> tag is displayed if frontend user is authenticated. Otherwise, everything inside the <f:else></f:else> tag is displayed.

Source code

Go to the source code of this ViewHelper: Security\IfAuthenticatedViewHelper.php (GitHub).

Arguments

The following arguments are available for the security.ifAuthenticated ViewHelper:

else
Type
mixed
Value to be returned if the condition if not met.
then
Type
mixed
Value to be returned if the condition if met.