<?php

use Acms\Services\Facades\Login;

class ACMS_POST_GetCsrfToken extends ACMS_POST
{
    public $isCacheDelete  = false;

    protected $isCSRF = false;

    public function post()
    {
        $token = '';
        if (Login::isLoggedIn()) {
            $csrfTokenManager = App::make('security.csrf');
            assert($csrfTokenManager instanceof \Acms\Services\Security\CsrfTokenManager);
            $token = $csrfTokenManager->createCsrfToken();
        }
        Response::json([
            'token' => $token,
        ]);
    }
}
