Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Hash:check() doesn't return result expected Laravel 10

$
0
0

I'm traing to check a password validation without do login in a Laravel 10 project, but the function 'check' returns false, moreover, I can do login with the same password. I Don't know why return false.

Thanks.

    public function recharge_by_client(Request $request){        $telf      = $request->telf;        $password  = $request->password;        $credit    = $request->credit;        try {            $client = Client::where('telf', $telf)->first();            //if verification data is false, returning 0.             if ($client && Hash::check($password, $client->password)) {                \Log::info('Entramos a update');                HomeHelper::recharge_money($client->id, $credit);            }else{                \Log::info('NO entramos a update');                return ['credit_updated' => 0];            }        } catch (\Exception $e) {            \Log::info($e->getMessage());            //A exception has ocurre, returning 0.            return ['credit_updated' => 0];        }        //Returning current credit.        return ['credit_updated' => Client::find($client->id)->credit];    }

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>