Check whether password is correct or not in Laravel

后端 未结 6 1631
傲寒
傲寒 2020-12-31 00:23

In laravel I want to check if user enter current password than check with that password which is store in database in that user data. If correct than continue otherwise give

6条回答
  •  忘掉有多难
    2020-12-31 00:47

    When the user attempts to access the page, redirect them to an auth page.

    Do the ajax call then do the following in your php:

    public function check(Request $request)
    {
        if(Hash::check($request->password, $user->password)) {
            // They match
        } else {
            // They don't match
        }
    }
    

    I havn't tested this so it might not work.

提交回复
热议问题