Auth::attempt
takes any array of required values, so just pass your condition in there like this:
Auth::attempt([
'login' => $login,
'password' => $password,
'confirmed' => 1
]);
I'm looking into the AuthenticatesAndRegisterUsers.php file, where the attempt function is called inside postLogin() function. I already modified it to ask for username in place of email as credential, but how do I add the "confirmed" field and how do I specify that I want it equal to 1? The code is
$this->validate($request, [
'username' => 'required', 'password' => 'required',
]);
$credentials = $request->only('username', 'password');
if ($this->auth->attempt($credentials, $request->has('remember')))
{
return redirect()->intended($this->redirectPath());
}
Ok, I've changed the $credentials variable to
$credentials = [
'username' => $request['username'],
'password' => $request['password'],
'confirmed' => 1
];
and now it works.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community