php - How do I prevent the mismatch token error in laravel? -


i started using laravel , it's great. lot of useful functionality etc. have problem csrf_token. session time default 120 minutes , let's log in, , browser tab stays open without me doing 120 minutes , expires, meaning have log in again. when on page after 120 minutes of inactivity, requires user authenticated, using post method, mismatch token exception error. need solve because indeed possibility user leave browser tab open without doing anything. know how solve this?

in app/exceptions/handle.php, replace render function 1 :

public function render($request, exception $e) {      if ($exception instanceof \illuminate\session\tokenmismatchexception) {             return redirect()             ->back()             ->withinput($request->except('password', '_token'))             ->witherror('validation token has expired. please try again');      }     return parent::render($request, $e); } 

it redirect same page new token.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -