User E-mail Confirmation On signup.

Posted 3 years ago by skaisser

Hey guys,

I've successfully been able to send an e-mail with a confirmation code to my user, and once that's confirmed it updates the column confirmed at the database with is a Boolean.

But, on laravel 5.1 i cant seem to block the user who did not confirmed their e-mail to login. I am trying to modify my Iluminate AuthenticatesUsers file, but i cant get it to work.

public function postLogin(Request $request)
        $this->validate($request, [
            $this->loginUsername() => 'required', 'password' => 'required',

        // 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();

        if ($throttles && $this->hasTooManyLoginAttempts($request)) {
            return $this->sendLockoutResponse($request);

        $credentials = $this->getCredentials($request);

        if (Auth::attempt($credentials, $request->has('remember'))) {
            return $this->handleUserWasAuthenticated($request, $throttles);

        // 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.
        if ($throttles) {

        return redirect($this->loginPath())
            ->withInput($request->only($this->loginUsername(), 'remember'))
                $this->loginUsername() => $this->getFailedLoginMessage(),

My Users table, has the confirmed. but i want the user only to login if the database Confirmed is 1, if not i want to validate a message telling the user to validate their e-mail before they can login.

I think this is important to other users also, And i've search all over google, but only found articles for laravel 4, i even tried to do it folowing the logic, but didnt go trough.

Thanks in advance

Please sign in or create an account to participate in this conversation.