CORS, trusted domain
This commit is contained in:
@@ -161,8 +161,20 @@ abstract class Request {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getCORS(): array {
|
||||
$settings = $this->context->getSettings();
|
||||
return $settings->getTrustedDomains();
|
||||
}
|
||||
|
||||
public final function execute($values = array()): bool {
|
||||
|
||||
if ($this->externalCall) {
|
||||
$trustedDomains = $this->getCORS();
|
||||
if (!empty($trustedDomains)) {
|
||||
header("Access-Control-Allow-Origin: " . implode(", ", $trustedDomains));
|
||||
}
|
||||
}
|
||||
|
||||
$this->params = array_merge([], $this->defaultParams);
|
||||
$this->success = false;
|
||||
$this->result = array();
|
||||
|
||||
Reference in New Issue
Block a user