I'm using auth system, and after user logged in if I refresh the page I get the 419 page expired error. I overrided authenticated method to redirect to profile after login. Here's my controller:
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
protected function authenticated()
{
return view("user.profile");
}
And here's my User model:
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $guarded = [];
const UPDATED_AT = null;
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
Try editing the render function in app\Exceptions\Handler.php by adding the code below.
if ($exception instanceof \Illuminate\Session\TokenMismatchException) {
return redirect('/login');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.