diff --git a/app/Livewire/BillingPortal/Authentication.php b/app/Livewire/BillingPortal/Authentication.php index edc7fb9c69c0..d567c4eb159f 100644 --- a/app/Livewire/BillingPortal/Authentication.php +++ b/app/Livewire/BillingPortal/Authentication.php @@ -12,17 +12,18 @@ namespace App\Livewire\BillingPortal; -use App\DataMapper\ClientSettings; -use App\Factory\ClientFactory; -use App\Jobs\Mail\NinjaMailerJob; -use App\Jobs\Mail\NinjaMailerObject; -use App\Mail\Subscription\OtpCode; -use App\Models\ClientContact; -use App\Models\Subscription; -use App\Repositories\ClientContactRepository; -use App\Repositories\ClientRepository; use Livewire\Component; use Illuminate\Support\Str; +use App\Models\Subscription; +use App\Models\ClientContact; +use App\Factory\ClientFactory; +use App\Jobs\Mail\NinjaMailerJob; +use App\DataMapper\ClientSettings; +use App\Mail\Subscription\OtpCode; +use App\Jobs\Mail\NinjaMailerObject; +use Illuminate\Support\Facades\Cache; +use App\Repositories\ClientRepository; +use App\Repositories\ClientContactRepository; class Authentication extends Component { @@ -101,7 +102,7 @@ class Authentication extends Component $code = rand(100000, 999999); $email_hash = "subscriptions:otp:{$this->email}"; - cache()->put($email_hash, $code, 120); + Cache::put($email_hash, $code, 600); $cc = new ClientContact(); $cc->email = $this->email; @@ -127,9 +128,9 @@ class Authentication extends Component 'otp' => 'required|numeric|digits:6', ]); - $code = cache()->get("subscriptions:otp:{$this->email}"); + $code = Cache::get("subscriptions:otp:{$this->email}"); - if ($this->otp !== $code) { + if ($this->otp != $code) { //loose comparison prevents edge cases $errors = $this->getErrorBag(); $errors->add('otp', ctrans('texts.invalid_code')); diff --git a/app/Mail/Subscription/OtpCode.php b/app/Mail/Subscription/OtpCode.php index b97f7fb1dd28..9fd81f01d3c7 100644 --- a/app/Mail/Subscription/OtpCode.php +++ b/app/Mail/Subscription/OtpCode.php @@ -58,6 +58,8 @@ class OtpCode extends Mailable 'title' => ctrans('texts.otp_code_subject'), 'content' => ctrans('texts.otp_code_body', ['code' => $this->code]), 'whitelabel' => $this->company->account->isPaid(), + 'url' => 'xx', + 'button' => false, ]); } }