Laravel redirect me back to the login page after each attempt to login. How do i fix this issue?
I've tried changing the session from 'file' to 'database' and clearing all the cache(both in the browser and in laravel, yet it's still redirects back to the login page)
Here is the web route:
// Login
Route::post("/profile/dashboard","LoginController@login")->name('login');
Here is my controller:
public function login(Request $req)
{
// validate form
$req->validate([
"email" => "required|email|max:255",
"password" => "required|max:16",
]);
$user = ["email" => $req->email, "password" => $req->password];
// Attempt to login
if (!Auth::attempt($user)) {
return back();
}
// Redirects to dashboard
return redirect()->route('dashboard');
}
Sorry for the poor formatting. Here is my view:
<form action=""
method="post" class="user">
<div class="form-group">
<input type="email" name="email" id="email" class="form-control
form-control-user" aria-describedby="emailHelp" placeholder="Enter Email Address...">
<label class="error" for="email">
@include("pages.errors.email")
</label>
</div>
<div class="form-group">
<input type="password" name="password" id="password" class="form-control form-control-user" placeholder="Password">
<label class="error" for="password">
<label class="error" for="password">
@include("pages.errors.password")
</label>
</label>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox small">
<input type="checkbox" class="custom-control-input" id="customCheck">
<label class="custom-control-label form-check-label" for="customCheck">Remember Me</label>
</div>
</div>
<button type="submit" class="btn btn-outline-success btn-user btn-block text-uppercase">Login</button>
<hr>
<a href="index.html" class="btn btn-danger btn-google
btn-user btn- block text-uppercase">
<i class="fab fa-google"></i> Login with Google
</a>
</form>
I dont't if this will help but here is my session set to database:
'driver' => env('SESSION_DRIVER', 'database'),
No Error was generate. It redirects back to the login page without any given error.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire