Skip to content

Firefly III: a personal finances manager

Check for block code. [skip ci]

James Cole89d565e63ba5
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,
]
);
}