Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nakerz99's avatar

php laravel 5.2 Auth:Attempt

php laravel 5.2

Hello Good day, im new in laravel, and i make my login page howeve when i try to input my email and pass only my email give authentication to my login page, when my email is true even my password is wrong it return true, also even my password is null although my email is correct it will return true.

this is my code: Usercontroller.php public function postsignIn(Request $request){ $credentials = array('email' => $request->email, 'password' => $request->password);

    if(Auth::attempt($credentials, false)){
        return redirect() -> route('dashboard');
    }
    return redirect()->back();
}

please help me. thank you so much.

0 likes
4 replies
tomopongrac's avatar

can you try with

$credentials = array('email' => $request->input('email'), 'password' => $request->input('password'));
nakerz99's avatar

hey Tomi, thank you so much for replying to my question, i already try the code that you suggested,

namespace App\Http\Controllers;

/**

*/ use App\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class UserController extends Controller {

public function getDashboard(){
    return view('dashboard');
}

public function postsignIn(Request $request){
    
    $credentials = array('email' => $request->input('email'), 'password' => $request->input('password'));
    if(Auth::attempt($credentials)){
        return redirect() -> route('dashboard');
    }
    return redirect()->back();
}

}

When i run my web page, it return same response, when i try to enter my email it return true even my password is null, however when i try to input my correct email and correct password it return false, anything that i input to my password it return false, please Help me. ! Thank you so much.

Please or to participate in this conversation.