Laravel -登录Laravel - Passowrd Hashlist('mD5')

im9ewurl  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(99)
public function masuk(Request $request)
{
    $this->validate($request, [
        'USERNAME_ACC'   => 'required',
        'PASSWORD' => 'required'
    ]);
    $username=$request->get('USERNAME_ACC');
    $password=$request->get('PASSWORD');

    // $pass=HASHBYTES('md5',$password);
    // dd($pass);

    

    $cek_user = User::where('USERNAME_ACC',$request->USERNAME_ACC)->where('PASSWORD',\DB::raw("HASHBYTES('md5','$password')"))->count();
    // dd($result->toArray());
    if ($cek_user==0) {
        return redirect('/login')->with('gagal','Username or Password Not Register');
    }else {
        $user=User::where('USERNAME_ACC',$request->USERNAME_ACC)->where('PASSWORD',\DB::raw("HASHBYTES('md5','$password')"))->first();
        if (Auth::guard('web')->login($user))
        {
            return redirect()->intended('admin');
        }
        return "Gagal";
    }
}

字符串
如何在Laravel中使用custome Hash登录
我使用哈希表('mD5')进行加密
请帮帮我吧!!

eblbsuwk

eblbsuwk1#

编辑config/hashing.php文件,把你需要的一个,它是负责编码的驱动程序

相关问题