OctoberCMS - Rainlab User Plugin - onLogout - Not found

1.5k views Asked by At

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>
1

There are 1 answers

5
Chirag Patel On BEST ANSWER

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.