allow login via username
This commit is contained in:
parent
9e8337efcb
commit
16a48cd2aa
2 changed files with 15 additions and 2 deletions
|
@ -41,6 +41,19 @@ class LoginController extends Controller
|
|||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the login username to be used by the controller.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function username()
|
||||
{
|
||||
$login = request()->input('email');
|
||||
$field = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'name';
|
||||
request()->merge([$field => $login]);
|
||||
return $field;
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
$validationRules = [
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="input-group mb-3">
|
||||
<input type="email" name="email"
|
||||
<input type="text" name="email"
|
||||
class="form-control @error('email') is-invalid @enderror"
|
||||
placeholder="{{ __('Email') }}">
|
||||
placeholder="{{ __('Email or Username') }}">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<span class="fas fa-envelope"></span>
|
||||
|
|
Loading…
Add table
Reference in a new issue