@risya can you share code so we could check what's the issue in that
Feb 2, 2023
9
Level 1
login page not redirect to dashboard page even after it went successful
hi, i need some help here. I'm not sure what went wrong but when user login the credentials and success but it still stay at login page and not redirect to my dashboard even when the user has verified the email?
LoginController :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
class LoginController extends Controller
{
public function index()
{
return view('auth.login');
}
public function customLogin(Request $request)
{
$request->validate([
'email' => 'required',
'password' => 'required',
]);
$credentials = $request->only('email', 'password');
if (Auth::attempt($credentials)) {
return redirect()->intended('dashboard')
->withSuccess('You have Successfully loggedin');
}
return redirect("/")->withSuccess('Oppes! You have entered invalid credentials');
}
public function dashboard()
{
if(Auth::check()){
return view('dashboard');
}
return redirect("/")->withSuccess('You are not allowed to access');
}
public function signOut() {
Session::flush();
Auth::logout();
return Redirect('/');
}
}
Please or to participate in this conversation.