Add input validation to LoginController
MODIFY
app/Http/Controllers/LoginController.php
app/Http/Controllers/LoginController.php
@@ -11,6 +11,11 @@ class LoginController extends Controller {
}
public function store(Request $request) {
+ $this->validate($request, [
+ 'email' => 'required|email',
+ 'password' => 'required'
+ ]);
+
$email = $request->input('email');
$password = $request->input('password');

MODIFY
public/style.css
public/style.css
@@ -262,3 +262,9 @@ table th, table td {
border-radius: 8px;
color: #FFF;
}
+
+.alert-inline {
+ margin-top: -24px;
+ margin-bottom: 32px;
+ color: #FA5764;
+}

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">
{{ csrf_field() }}
<label>E-mail</label>
<input type="email" name="email" />
+ @if ($errors->has('email'))
+ <div class="alert-inline">{{ $errors->first('email') }}</div>
+ @endif
<label>Password</label>
<input type="password" name="password" />
+ @if ($errors->has('password'))
+ <div class="alert-inline">{{ $errors->first('password') }}</div>
+ @endif
<div class="row tight">
<div class="column">
<input type="submit" value="Log in" />

Add input validation to LoginController