Skip to content

Commit

Permalink
Fix #17 : Capitalization of email address during login should not matter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubka committed Dec 1, 2020
1 parent 2dba3e9 commit 92be597
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ protected function sendLockoutResponse(Request $request)
return response()->json(['message' => Lang::get('auth.throttle', ['seconds' => $seconds])], Response::HTTP_TOO_MANY_REQUESTS);
}

/**
* Get the needed authorization credentials from the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function credentials(Request $request)
{
$credentials = [
$this->username() => strtolower($request->input($this->username())),
'password' => $request->get('password'),
];

return $credentials;
}


/**
* Validate the user login request.
Expand All @@ -117,7 +133,7 @@ protected function sendLockoutResponse(Request $request)
protected function validateLogin(Request $request)
{
$request->validate([
$this->username() => 'required|string|exists:users,email',
$this->username() => 'required|email|exists:users,email',
'password' => 'required|string',
]);
}
Expand Down

0 comments on commit 92be597

Please sign in to comment.