Ad

OctoberCMS - Rainlab User Plugin - OnLogout - Not Found

- 1 answer

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 foundenter 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 target="_blank" rel="nofollow noreferrer" href="{{ 'login'|page }}">Login</a></li>
            <li><a data-request="onLogout" data-request-data="redirect: '/good-bye'">Sign out</a></li>
        </ul>
    </nav>
</header>
Ad

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.

Ad
source: stackoverflow.com
Ad