I need to redirect the user to a simple informative view when throttling is detected during login.
I have a view called suspended.blade.php
I have set a route
Route::get('/suspended', function(){
return view('suspended');
});
I'm using Cartalyst/Sentinel.
In my login controller I have something like this:
function LoginUser(Request $request){
// some validation stuff...
try {
$user = Sentinel::authenticate($request->all());
} catch (ThrottlingException $e) {
// user inserted too many times a wrong password
return redirect('/suspended');
} catch (NotActivatedgException $e) {
return redirect()->back()->with( ['error' => "Account not active yet."] );
}
// some other stuff...
}
If I emulate trottling I only get an error page, instead of my view.
Why is that?
Thanks
EDIT Following the hints of @PsyLogic I modified my function like that:
function LoginUser(Request $request){
// some validation stuff...
try {
$user = Sentinel::authenticate($request->all());
}
/* remove this part to use the default behaviour described in app\Excpetions\Handler.php */
// catch (ThrottlingException $e) {
// return redirect('/suspended');
// }
catch (NotActivatedgException $e) {
return redirect()->back()->with( ['error' => "Account not active yet."]
);
}
// some other stuff...
}
Still does not work, and shows the Laravel Error Page with all the debug code.