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.
Improve the question by informing the version of Laravel and inserting at least the code of one of the relative views (file.blade.php)
– Marcos Xavier