I am integrating a controller which was working fine in laravel 5.4 for authentication a custom one which consist of throttles login trait as well.
$validator = Validator::make($request->all(), [
'username' => 'required',
'password' => 'required',
]);
if ($validator->fails()) {
return redirect('/go/login')
->withErrors($validator)
->withInput();
}
return $this->hasTooManyLoginAttempts($request);
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$credentials = $request->all();
$email = $credentials['username'];
$password = ($credentials['password']);
if (Auth::attempt(['email' => $email, 'password' => $password])) {
// session(['KCFINDER' => ['disabled' => false]]);
$this->clearLoginAttempts($request);
//return redirect('/go/verify/otp');
}
else{
$request->session()->flash('login', 'Please Try Again. Username and Password didnot Match.');
return redirect('/go/login');
}
This doesnot work in laravel 5.7
$this->hasTooManyLoginAttempts($request) : this function returns
BadMethodCallException Method App\Http\Controllers\LoginController::username does not exist.
public function username() { return 'username'; }
do you have this on your logincontroller ? – Anar Bayramov