From bd18317884934fb2737b6dbf5ab2de1e3824bee9 Mon Sep 17 00:00:00 2001 From: Erfan Mola Date: Tue, 10 Oct 2023 12:23:16 +0330 Subject: [PATCH] Check secret with hash --- api/app/Http/Controllers/DPX.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/app/Http/Controllers/DPX.php b/api/app/Http/Controllers/DPX.php index fb1228a..869bde0 100755 --- a/api/app/Http/Controllers/DPX.php +++ b/api/app/Http/Controllers/DPX.php @@ -181,20 +181,20 @@ public static function Verify(string $wallet, string $secret) { public static function RevokeSecret(string $wallet, string $secret) { - if (Wallet::where([ 'wallet' => $wallet, 'secret' => $secret ])->count() > 0) { + $wallet = Wallet::where('wallet', $wallet)->first(); + + if ($wallet && Hash::check($secret, $wallet->secret)) { $new_secret = DPX::GenerateRandomHash(); - Wallet::where([ 'wallet' => $wallet, 'secret' => $secret ])->update([ 'secret' => $new_secret ]); + Wallet::where([ 'wallet' => $wallet ])->update([ 'secret' => Hash::make($new_secret) ]); return $new_secret; - }else{ - - return false; - } + return false; + } public static function GetBalance(string $wallet) {