@philicevic can you show me your code?
Changing the authenticate-method in Laravel 5.5
Hey guys,
i wanted to add an E-Mail-Verification to my application, and for that i wanted to change the authentication. In the docs it says, that i can change it through adding a authenticate method in my LoginController.php:
https://laravel.com/docs/5.5/authentication#authenticating-users
This is not working for me, am i getting it wrong? Or did I miss something?
@philicevic if you saw the method is not authenticate it is authenticated
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
//
}
and if you read the comment, it clearly indicates that it is callback after your successful login
BUT if you want to add email verification then you need to override login method something like this in your LoginController.php.
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
public function login(Request $request)
{
if (Auth::attempt(['email' => request('email'), 'password' => request('password'), 'verified' => 1])) {
// Authentication passed...
return redirect()->intended('dashboard');
}
}
Note: as per the documentation the authenticate method is a manual method which you can use when you are not using AuthenticateUsers trait
Please or to participate in this conversation.