blash/commands/logout.json
2010-12-26 18:08:43 +01:00

34 lines
740 B
JSON

{
"name" : "logout",
"info" : {
"syntax" : "logout",
"brief" : "End the current user session",
},
"action" : function ( arg )
{
var out = '';
if ( shell.user == shell.json.user )
{
return out;
}
shell.user = shell.json.user;
document.cookie = '';
var users_php = window.location.href;
users_php = users_php.replace ( /\/([a-zA-Z\.]+)$/, '/modules/users/users.php' );
params = 'action=logout';
var http = new XMLHttpRequest();
http.open ( "POST", users_php, true );
http.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
http.setRequestHeader( "Content-length", params.length );
http.setRequestHeader( "Connection", "close" );
http.send ( params );
return out;
},
}