Use Grav nonce functionality

This commit is contained in:
Flavio Copes
2015-11-06 15:32:26 +01:00
parent d448b3bdce
commit 24f3df1c76
4 changed files with 13 additions and 0 deletions

View File

@@ -86,6 +86,11 @@ class AdminController
*/ */
public function execute() public function execute()
{ {
if (!Utils::verifyNonce($this->post['admin-nonce'], 'admin-post-blueprints')) {
$this->admin->setMessage('Unauthorized', 'error');
return false;
}
$success = false; $success = false;
$method = 'task' . ucfirst($this->task); $method = 'task' . ucfirst($this->task);
if (method_exists($this, $method)) { if (method_exists($this, $method)) {

View File

@@ -14,4 +14,7 @@
<div class="button-bar"> <div class="button-bar">
<button class="button primary">{{ "PLUGIN_ADMIN.CONTINUE"|tu }}</button> <button class="button primary">{{ "PLUGIN_ADMIN.CONTINUE"|tu }}</button>
</div> </div>
{{ nonce_field('admin-post-blueprints', 'admin-nonce') }}
</form> </form>

View File

@@ -10,4 +10,7 @@
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ nonce_field('admin-post-blueprints', 'admin-nonce') }}
</form> </form>

View File

@@ -18,4 +18,6 @@
{% include 'forms/fields/hidden/hidden.html.twig' %} {% include 'forms/fields/hidden/hidden.html.twig' %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{{ nonce_field('admin-post-blueprints', 'admin-nonce') }}
</form> </form>