nak llantada
nak llantada

Reputation: 3

Auth::attempt() laravel 5.2

please Help me, im new in laravel 5.2 i manually code my login page in laravel.

when i enter my email address correctly in my login page even my password is null or incorrect it return true.

here is my code

userController.php public function postSignIn(Request $request){

    $user = array(
        'email' => $request->input('email'),
        'password' => $request->input('password')
    );

        if (Auth::attempt($user)) {
            return redirect() -> route('dashboard');

        }
      return redirect()->back();

}

}

please help me. thank you so much.

Upvotes: 0

Views: 432

Answers (1)

Edion Larosa
Edion Larosa

Reputation: 114

Try dumping the data so you can see if the data being passed is correct.

$credentials =['email' => $request['email'], 'password' =>     $request['password'];

var_dump($credentials);

If you're sure the data is correct, then better to check the return of the attemp()

var_dump( Auth::attempt($credentials));

You can also check data validation here: https://laravel.com/docs/5.2/validation

Also, it is good to check your database(users table) for null records.

Upvotes: 0

Related Questions