dealhub/app/Actions/PasswordReset/VerifyOTPAction.php
kusowl aa7e2f245f misx bugfixes:
- fix users cannot reset password due session expiration
- add a new mail when users contacts via Contact form
- add list page for all deals in broker dashboard
- fixed links in home page
2026-02-03 16:06:26 +05:30

26 lines
595 B
PHP

<?php
namespace App\Actions\PasswordReset;
use App\Exceptions\UserNotFoundException;
use App\Models\User;
use App\Services\OTPService;
final readonly class VerifyOTPAction
{
public function __construct(
private OTPService $otpService,
) {}
/**
* @throws \Throwable
*/
public function execute(array $data): bool
{
$user = \Session::get('otp_user_id') ? User::find(\Session::get('otp_user_id')) : null;
throw_if(! $user, new UserNotFoundException('User not found'));
return $this->otpService->verify($user, $data['otp']);
}
}