Skip to content
Snippets Groups Projects
Commit 3830c405 authored by Jean-François Ferry's avatar Jean-François Ferry
Browse files

Disable CSRF check for REST API

This allow to do POST requests from another website.
parent 5b49b7bc
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
*
*/
if (! defined("NOLOGIN")) define("NOLOGIN",'1');
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1');
$res=0;
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
......@@ -121,9 +122,9 @@ foreach ($modulesdir as $dir)
$classname = str_replace('Api_','',ucwords($reg[1])).'Api';
$classname = ucfirst($classname);
require_once $dir_part.$file_searched;
if (class_exists($classname))
if (class_exists($classname))
{
dol_syslog("Found API classname=".$classname);
dol_syslog("Found API classname=".$classname);
$api->r->addAPIClass($classname,'');
$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched);
}
......@@ -142,7 +143,3 @@ foreach ($modulesdir as $dir)
// Call API (we suppose we found it)
$api->r->handle();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment