Expanded the message a user may get when his credentials do not work.

This commit is contained in:
James Cole
2015-07-26 07:39:21 +02:00
parent 6c6598dac5
commit 2492b1fa96

View File

@@ -9,10 +9,10 @@ use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Mail\Message; use Illuminate\Mail\Message;
use Mail; use Mail;
use Request as Rq;
use Session; use Session;
use Twig; use Twig;
use Validator; use Validator;
use Request as Rq;
/** /**
* Class AuthController * Class AuthController
@@ -69,12 +69,17 @@ class AuthController extends Controller
// default error message: // default error message:
$message = $this->getFailedLoginMessage(); $message = $this->getFailedLoginMessage();
// try to find a user with this address and blocked_code "bounced". // try to find a blocked user with this email address.
$count = User::where('email', $credentials['email'])->where('blocked', 1)->where('blocked_code', 'bounced')->count(); /** @var User $foundUser */
if ($count == 1) { $foundUser = User::where('email', $credentials['email'])->where('blocked', 1)->first();
$message = trans('firefly.bounce_error', ['email' => $credentials['email']]); if (!is_null($foundUser)) {
// if it exists, show message:
$code = $foundUser->blocked_code;
$message = trans('firefly.' . $code . '_error', ['email' => $credentials['email']]);
} }
// try
// 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.