Add error to login view if authentication failed
MODIFY
app/Http/Controllers/LoginController.php
app/Http/Controllers/LoginController.php
@@ -20,7 +20,11 @@ class LoginController extends Controller {
])) {
return redirect()->route('dashboard.index');
} else {
- return redirect()->route('login.index');
+ return redirect()
+ ->route('login.index')
+ ->withErrors([
+ 'credentials' => 'There\'s no user with that email address/password'
+ ]);
}
}
}

MODIFY
public/style.css
public/style.css
@@ -239,3 +239,13 @@ table {
table td {
padding: 32px;
}
+
+/* Alert */
+
+.alert {
+ padding: 24px;
+ text-align: center;
+ background: #FC5865;
+ border-radius: 8px;
+ color: #FFF;
+}

MODIFY
resources/views/login/index.blade.php
resources/views/login/index.blade.php
@section('body')
<div class="row">
<div class="column size-560 align-center">
+ @if ($errors->any())
+ <div class="alert spacing-bottom-large">{{ $errors->first() }}</div>
+ @endif
<h1 class="spacing-bottom-large">Log in</h1>
<div class="box spacing-small">
<form method="POST">

Add error to login view if authentication failed