Tuesday, February 20, 2018

Failed verification of login - development

Failed verification of login

I am trying to verify my users who log into the system. I have used hashed passwords to store the passwords. When I try to verify the users, I get an error as follows:

strlen() expects parameter 1 to be string, array given

I have searched various ways of solving this issue but I can’t find a way.

Here is my code.

controller.php

public function logs_in(Request $request){
    $email = $request->input('email');
    $password = $request->input('password');


    $hashedPassword = DB::select('select password from users where email = ?', [$email]);


    if(Hash::check($password, $hashedPassword)){
        $request->session()->put('success');
        return redirect()->route('admin');
    } else {
        return redirect()->route('login')->with('login_error', 'Invalid 
        credentials entered');
    }
}

What could possibly be wrong?



from Laravel Questions and Answers https://laravelquestions.com/php/failed-verification-of-login/
via Lzo Media

No comments:

Post a Comment