We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

about error 'CSRF validation failed' for developers

Hello everyone. This is a continuation of the discussion https://forum.phalcon.io/discussion/1091/csrf-validation-failed Dear developers, explain the reason for the error 'CSRF validation failed' I only make one change to the project vokuro.

ControllerBase.php

public function beforeExecuteRoute(Dispatcher $dispatcher)
    {
        //Get the current identity
        $identity = $this->auth->getIdentity();
        if (!$identity) {
            if ($controllerName != 'session') {
                $dispatcher->forward(array(
                    'controller' => 'session',
                    'action' => 'login'
                ));
                return false;
            }
        }
        ......

The error occurs on the login page. My goal is to protect the entire application from unauthorized users



42.1k

Hmm .... Everything works fine on Windows. What's wrong with my Linux and php???