Mavichow
Mavichow

Reputation: 1223

OctoberCMS - Rainlab User Plugin - onLogout - Not found

Login page

Included User's Account component in login.htm page, data-request="onSignin" works fine enter image description here

Logout button

Included Session's component in the navigation partial, data-request="onLogout" , hit error enter image description here

Ajax handler not found enter image description here

Questions: Can I include [session] in global partial to make sure "Logout" Ajax handler can trigger on every pages?

OR do I need to include [session] in each of every my created pages ( this seems really hardcoded ) ? May I know what's the best practice of doing/including the component

[session]
security = "all"
==
<header>    
    <nav>
        <ul>
            <li><a href="{{ 'login'|page }}">Login</a></li>
            <li><a data-request="onLogout" data-request-data="redirect: '/good-bye'">Sign out</a></li>
        </ul>
    </nav>
</header>

Upvotes: 1

Views: 1636

Answers (1)

Chirag Patel
Chirag Patel

Reputation: 1642

You can use Session component globally if you will add a session in your default layout file e.g. default.htm

So Open you default layout in Backend CMS menu and assign session component there and onLogout error will be solved for sure.

If any doubt please comment.

Upvotes: 1

Related Questions