A logged in user can edit his profile. If he presses "Save" then the data will be send by AJAX and he gets an success message: 
If the user logs out in a different tab, then the "Save" button does not work anymore. I would like to let the user know with an ajax warning(just as above, but in red instead of green), that he is logged out.
This is my code:
public function __construct()
{
$this->middleware('auth',['except' => 'updateContact']);
}
public function updateContact(Request $request)
{
if(!Auth::check()){
return json_encode(['status' => false, 'msg' => 'You are not logged in! Chanes are not saved!']);
}
However, this does not work. THe method is not returning anything. Instead I get a warning
The page has expired due to inactivity.
It looks to me that the CSRF token is invalid as soon as I logout a user. Why is that and how can I fix it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire