Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

php - credentials do not match our records

I am currently working on POS in laravel 8. I am having an error when I login in that "credentials do not match our records" When I login in through the default Register page than it works fine but when I register through internal panel than the data goes to the database but I face error when I log in.

Code for registration through panel:

public function store(Request $request)
{
    $users = new User;
    $users->name = $request->name;
    $users->email = $request->email;
    $users->password =  Hash::make($request->name);
    // $users->password =  bcrypt($request->name);

    $users->is_admin = $request->is_admin;
    $users->save();


    if($users){
        return redirect()->back()->with('User Created Successfully');
    }
    return redirect()->back()->with('User Failed Created');
}

Default register code:

protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => Hash::make($data['password']),
    ]);
}
question from:https://stackoverflow.com/questions/65897775/credentials-do-not-match-our-records

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your panel registration form is hashing the name input and not the password input.

$users->password =  Hash::make($request->name);

Should probably be

$users->password =  Hash::make($request->password);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...