Check for block code. [skip ci]

This commit is contained in:
James Cole
2015-07-25 07:03:50 +02:00
parent 150b6fe5b6
commit 89d565e63b

View File

@@ -60,12 +60,21 @@ class AuthController extends Controller
} }
$credentials = $this->getCredentials($request); $credentials = $this->getCredentials($request);
$credentials['blocked'] = 0; $credentials['blocked'] = 0; // most not be blocked.
if (Auth::attempt($credentials, $request->has('remember'))) { if (Auth::attempt($credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles); 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 // 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 // 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. // 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')) ->withInput($request->only($this->loginUsername(), 'remember'))
->withErrors( ->withErrors(
[ [
$this->loginUsername() => $this->getFailedLoginMessage(), $this->loginUsername() => $message,
] ]
); );
} }