Only check for nonce if the getNonce method exists (nonces are implemented in Grav)

This commit is contained in:
Flavio Copes
2015-11-13 18:20:18 +01:00
parent db540c9c1f
commit 1840eb80f3

View File

@@ -87,9 +87,11 @@ class AdminController
public function execute()
{
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
if (!isset($this->post['admin-nonce']) || !Utils::verifyNonce($this->post['admin-nonce'], 'admin-form')) {
$this->admin->setMessage('Unauthorized', 'error');
return false;
if (method_exists('Utils', 'getNonce')) {
if (!isset($this->post['admin-nonce']) || !Utils::verifyNonce($this->post['admin-nonce'], 'admin-form')) {
$this->admin->setMessage('Unauthorized', 'error');
return false;
}
}
}