Skip to content

Auth Controller

The <auth-controller> webcomponent is used to render any content inside of it depending on whether the user is logged in or not.

Usage requires adding two HTML elements, one with slot="logged-in" attribute and the other with slot="logged-out" attribute. In those elements you can provide any valid HTML template to render under those conditions.

This webcomponent is used in blog_article_comments module.

Attributes

none

Example

<auth-controller hidden>
    <div slot="logged-in">
        <h1>Logged in</h1>
    </div>
    <div slot="logged-out">
        <p>Logged out</p>
    </div>
</auth-controller>
<auth-controller>
    <div slot="logged-in">
        <h1>Logged in</h1>
    </div>
</auth-controller>
<auth-controller>
    <div slot="logged-out">
        <p>Logged out</p>
    </div>
</auth-controller>

Modules reference