Validation CSRF giving error after a time without use

2

I have an application already running with codeigniter and I have csrf enabled on the system. The problem is in a page that has a form that sends to itself, is a filter, but it is the following, the user does the post and has the results on the screen, until there is everything right, but if the user leaves the page open, then goes on and off the computer and another day it turns on the PC and opens on the same page gives me an error that the user is not allowed The action you have requested is not allowed. . What I want to know is if you have how to get this error in _construct or how can I know of this error in order to redirect the user to some other page?

    
asked by anonymous 13.08.2014 / 15:07

1 answer

4

The answer to your question is here: link

Basically, you should extend the CI_Security class. To do this, create a file called MY_Security.php in application / core / and change the functionality of the csrf_show_error () method as desired:

class MY_Security extends CI_Security {

    public function __construct()
    {
        parent::__construct();
    }

    public function csrf_show_error()
    {
        // adicione seu redirecionamento aqui
    }

}

I hope I have helped.

    
13.08.2014 / 15:29