From 89d565e63ba529a1d7cbe7b1ca1e2a2dd294119a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 25 Jul 2015 07:03:50 +0200 Subject: [PATCH] Check for block code. [skip ci] --- app/Http/Controllers/Auth/AuthController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 97e9bf6a09..538263450d 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -60,12 +60,21 @@ class AuthController extends Controller } $credentials = $this->getCredentials($request); - $credentials['blocked'] = 0; + $credentials['blocked'] = 0; // most not be blocked. if (Auth::attempt($credentials, $request->has('remember'))) { return $this->handleUserWasAuthenticated($request, $throttles); } + // default error message: + $message = $this->getFailedLoginMessage(); + + // try to find a user with this address and blocked_code "bounced". + $count = User::where('email', $credentials['email'])->where('blocked', 1)->where('blocked_code', 'bounced')->count(); + if ($count == 1) { + $message = trans('firefly.bounce_error', ['email' => $credentials['email']]); + } + // 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. @@ -77,7 +86,7 @@ class AuthController extends Controller ->withInput($request->only($this->loginUsername(), 'remember')) ->withErrors( [ - $this->loginUsername() => $this->getFailedLoginMessage(), + $this->loginUsername() => $message, ] ); }