Login error message does not appear - LARAVEL 5.8

Asked

Viewed 551 times

2

My application has a login system done in the Windows with the command php artisan. But when the user misses the password or the email, the system just reloads the page and does not return the error message. The same applies when a new user is registered and the email is already registered, the error message is not returned. I don’t know where to look for that mistake. This is my Logincontroller.php:

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{

    use AuthenticatesUsers;

/**
 * Where to redirect users after login.
 *
 * @var string
 */
protected $redirectTo = '/home';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest')->except('logout');
}
}

This is my Login view:

 <!DOCTYPE html>
    <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <!-- favicon e título -->
    <link rel="shortcut icon" type="image/png" href="/storage/imagens/favicon.ico">

    <script src="{{ asset('js/app.js')}}" type="text/javascript"></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-sm-12 container-login">
                @if($errors->any())

                <ul class="list-group">

                    @foreach($errors->all() as $error)

                    <li class="list-group-item list-group-item-danger">{{$error}}</li>

                    @endforeach

                </ul>
                @endif

                <form class="col-sm-4 box-login" method="POST" action="{{ route('login') }}">
                    @csrf
                    <img src="/storage/imagens/logologin.png" alt="Logo" class="img-fluid logo mb-5">
                    <div class="form-group">
                        <input id="email" type="email" placeholder="Email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>
                        @if ($errors->has('email'))
                        <span class="invalid-feedback" role="alert">
                            <strong>{{ $errors->first('email') }}</strong>
                        </span>
                        @endif
                    </div>
                    <div class="form-group">
                        <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required placeholder="Senha">
                        @if ($errors->has('password'))
                        <span class="invalid-feedback" role="alert">
                            <strong>{{ $errors->first('password') }}</strong>
                        </span>
                        @endif
                    </div>
                    <button type="submit" data-loading-text="Aguarde..." class="btn btn-success btn-block mt-4">Entrar</button>
                    <div class="form-group text-right">
                        @if (Route::has('password.request'))
                        <a class="recuperar" href="{{ route('password.request') }}">
                            {{ __('Esqueceu sua Senha?') }}
                        </a>
                        @endif
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>

</html>

I don’t know if it’s wrong, I’ve tried everything and nothing.

  • 2

    Improve the question by informing the version of Laravel and inserting at least the code of one of the relative views (file.blade.php)

1 answer

0

I checked here and is working normally as shown in the image:

inserir a descrição da imagem aqui

  • 1

    The problem is in my application, I can’t tell you where, but it’s somewhere. Can you tell me somewhere that could block these messages?

  • @Williamfreire have you tried to update with Composer update? I ask you to evaluate my response..

  • 1

    I tried yes, I have already tested in other applications Adjustable putting the same controller code and login view and there it worked, however, in my application does not work

  • 1

    my application goes to production this week, not the time to redo the application

  • I found where the bug was. It was in Kernel.php. My Kernel had this last line: \Illuminate\Session\Middleware\StartSession::class,. When I took that line, it again displayed the error messages. However I am having problems with my API’S. The following error appears: {message: "Unauthorized", Exception: "Symfony Component Httpkernel Exception Httpexception",... } Exception: "Symfony Component Httpkernel Exception Httpexception"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.