@@ -20,8 +20,6 @@ class LoginController extends Controller
2020{
2121 use AuthenticatesUsers;
2222
23- const USER_INPUT_FIELD = 'user ' ;
24-
2523 /**
2624 * @var \Illuminate\Auth\AuthManager
2725 */
@@ -64,14 +62,14 @@ class LoginController extends Controller
6462 *
6563 * @var int
6664 */
67- protected $ lockoutTime ;
65+ protected $ decayMinutes ;
6866
6967 /**
7068 * After how many attempts should logins be throttled and locked.
7169 *
7270 * @var int
7371 */
74- protected $ maxLoginAttempts ;
72+ protected $ maxAttempts ;
7573
7674 /**
7775 * LoginController constructor.
@@ -98,8 +96,8 @@ public function __construct(
9896 $ this ->google2FA = $ google2FA ;
9997 $ this ->repository = $ repository ;
10098
101- $ this ->lockoutTime = $ this ->config ->get ('auth.lockout.time ' );
102- $ this ->maxLoginAttempts = $ this ->config ->get ('auth.lockout.attempts ' );
99+ $ this ->decayMinutes = $ this ->config ->get ('auth.lockout.time ' );
100+ $ this ->maxAttempts = $ this ->config ->get ('auth.lockout.attempts ' );
103101 }
104102
105103 /**
@@ -112,7 +110,7 @@ public function __construct(
112110 */
113111 public function login (Request $ request )
114112 {
115- $ username = $ request ->input (self :: USER_INPUT_FIELD );
113+ $ username = $ request ->input ($ this -> username () );
116114 $ useColumn = $ this ->getField ($ username );
117115
118116 if ($ this ->hasTooManyLoginAttempts ($ request )) {
@@ -209,20 +207,30 @@ protected function sendFailedLoginResponse(Request $request, Authenticatable $us
209207 {
210208 $ this ->incrementLoginAttempts ($ request );
211209 $ this ->fireFailedLoginEvent ($ user , [
212- $ this ->getField ($ request ->input (self :: USER_INPUT_FIELD )) => $ request ->input (self :: USER_INPUT_FIELD ),
210+ $ this ->getField ($ request ->input ($ this -> username ())) => $ request ->input ($ this -> username () ),
213211 ]);
214212
215- $ errors = [self :: USER_INPUT_FIELD => trans ('auth.failed ' )];
213+ $ errors = [$ this -> username () => trans ('auth.failed ' )];
216214
217215 if ($ request ->expectsJson ()) {
218216 return response ()->json ($ errors , 422 );
219217 }
220218
221219 return redirect ()->route ('auth.login ' )
222- ->withInput ($ request ->only (self :: USER_INPUT_FIELD ))
220+ ->withInput ($ request ->only ($ this -> username () ))
223221 ->withErrors ($ errors );
224222 }
225223
224+ /**
225+ * Get the login username to be used by the controller.
226+ *
227+ * @return string
228+ */
229+ public function username ()
230+ {
231+ return 'user ' ;
232+ }
233+
226234 /**
227235 * Determine if the user is logging in using an email or username,.
228236 *
0 commit comments