芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/tblonline.org/app/Http/Controllers/Auth/LoginController.php
middleware('guest')->except('logout'); } protected function credentials(Request $request) { return [ 'email' => $request->{$this->username()}, 'password' => $request->password, 'status' => 1, ]; } /** * Handle a login request to the application. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse * * @throws \Illuminate\Validation\ValidationException */ public function login(Request $request) { $this->validateLogin($request); // If the class is using the ThrottlesLogins trait, we can automatically throttle // the login attempts for this application. We'll key this by the username and // the IP address of the client making these requests into this application. if (method_exists($this, 'hasTooManyLoginAttempts') && $this->hasTooManyLoginAttempts($request)) { $this->fireLockoutEvent($request); return $this->sendLockoutResponse($request); } if ($this->attemptLogin($request)) { return $this->sendLoginResponse($request); } // 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); return $this->sendFailedLoginResponse($request); } /** * Validate the user login request. * * @param \Illuminate\Http\Request $request * @return void * * @throws \Illuminate\Validation\ValidationException */ protected function validateLogin(Request $request) { config(['recaptchav3.sitekey' => get_option('recaptcha_site_key')]); config(['recaptchav3.secret' => get_option('recaptcha_secret_key')]); $request->validate([ $this->username() => 'required|string', 'password' => 'required|string', 'g-recaptcha-response' => get_option('enable_recaptcha', 0) == 1 ? 'required|recaptchav3:login,0.5' : '', ], [ 'g-recaptcha-response.recaptchav3' => _lang('Recaptcha error!'), ]); } protected function authenticated(Request $request, $user) { if ($user->status != 1) { $errors = [$this->username() => _lang('Your account is not active !')]; Auth::logout(); return back()->withInput($request->only($this->username(), 'remember')) ->withErrors($errors); } } /** * Get the failed login response instance. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ protected function sendFailedLoginResponse(Request $request) { $errors = [$this->username() => trans('auth.failed')]; $user = \App\Models\User::where($this->username(), $request->{$this->username()})->first(); if ($user && \Hash::check($request->password, $user->password) && $user->status != 1) { $errors = [$this->username() => _lang('Your account is not active !')]; } if ($request->expectsJson()) { return response()->json($errors, 422); } return back()->withInput($request->only($this->username(), 'remember')) ->withErrors($errors); } }