CMD_LOGOUT to log out is deprecated.

zmicier0k

Verified User
Joined
Jul 19, 2022
Messages
6
Hi, guys. I'm using custom skin and I have a problem with logout function. Such error appears after I click logout button:

"Using "GET /CMD_LOGOUT" to log out is deprecated. Please consider using "/api/logout" or "/api/session/login-as/return" to handle logout functions"

I'm trying to swap CMD_LOGOUT to api/logout in file header_bar.html but only blank page appears after I press logout button.

Part of the header_bar.html
HTML:
<td width=100% align=right><a onMouseOver="navlogout.src=logout_image.src;" onMouseOut="navlogout.src='/|LANG_IMG_SKIN_NAV_LOGOUT|';" href="/CMD_LOGOUT"><img name="navlogout" border="0" src="/|LANG_IMG_SKIN_NAV_LOGOUT|" width="93" height="78" alt="|LANG_LOGOUT|"></a></td>

What should I change to be able to successfully logout from admin panel?
 
I guess you have customized skin (like me).
If you change it back to evolution or enhanced, it is OK.
(Or, you may re-apply the change (a few thing) to the customized skin.)
 
I guess you have customized skin (like me).
If you change it back to evolution or enhanced, it is OK.
(Or, you may re-apply the change (a few thing) to the customized skin.)
Thanks but I don't wanna use default skins. Do you know which changes should I made in custom skin to be able to use /api/logout instead of CMD_LOGOUT?
 
It seems like the problem was solved. I've pasted such sequnces of code in my skin files:
1) header.html

Code:
        function log_me_out()
        {
|*if USERNAME!=LOGIN_AS_MASTER_NAME|
            fetch("/api/session/login-as/return",{method:"POST"})
                .then(x=>{window.location.href = "/CMD_SHOW_USER?user=|USERNAME|"})
                .catch(x=>{window.location.href = "/"})
|*else|
            fetch("/api/logout",{method:"POST"})
                .then(x=>x.json())
                .then(x=>{window.location.href = x.logoutURL || "/"})
                .catch(x=>{window.location.href = "/"})
|*endif|
        }
        var logout_timeout = setTimeout('log_me_out();', |SESSION_MINUTES|*60*1000);

2) header_wide.html

Code:
<td width="100%" align=right><a onMouseOver="navlogout.src=logout_image2.src;" onMouseOut="navlogout.src='/|LANG_IMG_SKIN_NAV_LOGOUT2|';" href="/CMD_LOGOUT"  onclick="log_me_out();return false"><img name="navlogout" border="0" src="/|LANG_IMG_SKIN_NAV_LOGOUT2|" width="93" height="78" alt="|LANG_LOGOUT|"></a></td>

3) header_bar.html
Code:
<td width=100% align=right><a onMouseOver="navlogout.src=logout_image.src;" onMouseOut="navlogout.src='/|LANG_IMG_SKIN_NAV_LOGOUT|';" href="/CMD_LOGOUT" onclick="log_me_out();return false"><img name="navlogout" border="0" src="/|LANG_IMG_SKIN_NAV_LOGOUT|" width="93" height="78" alt="|LANG_LOGOUT|"></a></td>
 
I am glad you found the solution. For custom skins, it is usually best to compare them to what Enhanced Skin does and copy the changed parts. We update the Enhanced Skin to stay compatible, so it is useful as a reference.
 
Back
Top