+ // If the login attempt was unsuccessful we will increment the number of attempts
+ // to login and redirect the user back to the login form. Of course, when this
+ // user surpasses their maximum number of attempts they will get locked out.
+ $this->incrementLoginAttempts($request);
+
+ Activity::logFailedLogin($username);
+
+ return $this->sendFailedLoginResponse($request);
+ }
+
+ /**
+ * Attempt to log the user into the application.
+ *
+ * @param \Illuminate\Http\Request $request
+ *
+ * @return bool
+ */
+ protected function attemptLogin(Request $request)
+ {
+ return $this->loginService->attempt(
+ $this->credentials($request),
+ auth()->getDefaultDriver(),
+ $request->filled('remember')
+ );
+ }
+
+ /**
+ * The user has been authenticated.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param mixed $user
+ *
+ * @return mixed
+ */
+ protected function authenticated(Request $request, $user)
+ {
+ return redirect()->intended($this->redirectPath());
+ }
+
+ /**
+ * Validate the user login request.
+ *
+ * @param \Illuminate\Http\Request $request
+ *
+ * @throws \Illuminate\Validation\ValidationException
+ *
+ * @return void
+ */
+ protected function validateLogin(Request $request)
+ {
+ $rules = ['password' => ['required', 'string']];
+ $authMethod = config('auth.method');
+
+ if ($authMethod === 'standard') {
+ $rules['email'] = ['required', 'email'];
+ }
+
+ if ($authMethod === 'ldap') {
+ $rules['username'] = ['required', 'string'];
+ $rules['email'] = ['email'];
+ }
+
+ $request->validate($rules);
+ }
+
+ /**
+ * Send a response when a login attempt exception occurs.
+ */
+ protected function sendLoginAttemptExceptionResponse(LoginAttemptException $exception, Request $request)
+ {
+ if ($exception instanceof LoginAttemptEmailNeededException) {