Skip to content

Commit

Permalink
Move login attempt to separate method to make it easier to alter logi…
Browse files Browse the repository at this point in the history
…n attempt logic without the need to override the entire login() method. For example to chang credentials or add other params
  • Loading branch information
ivandokov committed Nov 8, 2016
1 parent 7b55237 commit 42d336a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Illuminate/Foundation/Auth/AuthenticatesUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public function login(Request $request)
return $this->sendLockoutResponse($request);
}

$credentials = $this->credentials($request);

if ($this->guard()->attempt($credentials, $request->has('remember'))) {
if ($this->attemptLogin($request)) {
return $this->sendLoginResponse($request);
}

Expand All @@ -66,6 +64,17 @@ protected function validateLogin(Request $request)
]);
}

/**
* @param Request $request
* @return bool
*/
protected function attemptLogin(Request $request)
{
$credentials = $this->credentials($request);

return $this->guard()->attempt($credentials, $request->has('remember'));
}

/**
* Get the needed authorization credentials from the request.
*
Expand Down

0 comments on commit 42d336a

Please sign in to comment.