mercredi 25 mars 2020

Hash::check always return false when compare password

I tried to compare the password that inserted from form (confirm_password) and user password. But, I still have false output when use Hash::check()

public function password_verification(Request $request){
    $verify_password = $request->current_password;
    $encrypted_verify_password = Hash::make($verify_password);
    $password = Auth::user()->password;
    if (Hash::check($verify_password,$password)) {
        $res['success'] = true;
        $res['message'] = "Success";
        return response($res);
    }else{
        $res['success'] = false;
        $res['message'] = "Error";
        return response($res);
    }
} 

When I input 111111 in current_password, I checked $encrypted_verify_password and $password. $encrypted_verify_password = $2y$10$w0c./s4rwd.aTE99bdCf.O4a7fvDFERZ2isww.9QYvDZHYmFRDohu (its value changed when recall this fuction) $password = $2y$10$mw3Wupj5nCYGJPnQIT53QuDzkxka//sncbpG8nfdF/2FOjQOsK3Au

What is solution?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Jri6IB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire