A free open source IT asset/license management system
Updated traits and method names for 5.3
snipe433adb1dcb3c
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.phpindex 0c48d370f7..9fbe7d9cb6 100644--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@ -122,16 +122,11 @@ class LoginController extends Controllerreturn redirect()->back()->withInput()->withErrors($validator);}- // 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.- //$throttles = $this->isUsingThrottlesLoginsTrait();$this->maxLoginAttempts = config('auth.throttle.max_attempts');$this->lockoutTime = config('auth.throttle.lockout_duration');if ($lockedOut = $this->hasTooManyLoginAttempts($request)) {$this->fireLockoutEvent($request);-return $this->sendLockoutResponse($request);}@@ -157,16 +152,14 @@ class LoginController extends Controller// Try to log the user inif (!Auth::attempt(Input::only('username', 'password'), Input::get('remember-me', 0))) {- if ($throttles && ! $lockedOut) {+ if (!$lockedOut) {$this->incrementLoginAttempts($request);}LOG::debug("Local authentication failed.");return redirect()->back()->withInput()->with('error', trans('auth/message.account_not_found'));} else {- if ($throttles) {$this->clearLoginAttempts($request);- }}}@@ -278,18 +271,31 @@ class LoginController extends Controller]);}- /**- * Get the login lockout error message.- *- * @param int $seconds- * @return string- */- protected function getLockoutErrorMessage($seconds)++ public function username(){- return \Lang::has('auth/message.throttle')- ? \Lang::get('auth/message.throttle', ['seconds' => $seconds])- : 'Too many login attempts. Please try again in '.$seconds.' seconds.';+ return 'username';}+ /**+ * Redirect the user after determining they are locked out.+ *+ * @param \Illuminate\Http\Request $request+ * @return \Illuminate\Http\RedirectResponse+ */+ protected function sendLockoutResponse(Request $request)+ {+ $seconds = $this->limiter()->availableIn(+ $this->throttleKey($request)+ );++ $message = \Lang::has('auth/message.throttle')+ ? \Lang::get('auth/message.throttle', ['seconds' => $seconds])+ : 'Too many login attempts. Please try again in '.$seconds.' seconds.';++ return redirect()->back()+ ->withInput($request->only($this->username(), 'remember'))+ ->withErrors([$this->username() => $message]);+ }}diff --git a/app/Models/User.php b/app/Models/User.phpindex 76571e5b4e..34bf50495f 100755--- a/app/Models/User.php+++ b/app/Models/User.php@@ -10,6 +10,7 @@ use Watson\Validating\ValidatingTrait;use Illuminate\Database\Eloquent\SoftDeletes;use App\Http\Traits\UniqueUndeletedTrait;use App\Models\Setting;+use Illuminate\Notifications\Notifiable;class User extends Model implements AuthenticatableContract, CanResetPasswordContract{@@ -19,6 +20,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordConuse Authenticatable;use CanResetPassword;use UniqueUndeletedTrait;+ use Notifiable;protected $dates = ['deleted_at'];protected $table = 'users';