добавил api авторизацию
This commit is contained in:
parent
7080f92d9f
commit
f5325b5852
|
|
@ -10,6 +10,12 @@ class API extends Plugin
|
||||||
$this->config["key"] = sha1(rand() . uniqid());
|
$this->config["key"] = sha1(rand() . uniqid());
|
||||||
$this->context->getConfig()->save();
|
$this->context->getConfig()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$headers = getallheaders();
|
||||||
|
|
||||||
|
if ($headers and isset($headers["X-Auth"]) and $headers["X-Auth"] == md5($this->config["key"])) {
|
||||||
|
$_SESSION["auth"] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getKey(): string
|
public function getKey(): string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue