40 lines
908 B
PHP
40 lines
908 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Auth;
|
|
|
|
use App\Livewire\Forms\Auth\ForgotPasswordForm;
|
|
use App\Traits\Components\WithToast;
|
|
use Illuminate\Support\Facades\Password;
|
|
use Illuminate\View\View;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('components.layouts.auth', [
|
|
'title' => 'Lupa Kata Sandi',
|
|
])]
|
|
class ForgotPassword extends Component
|
|
{
|
|
use WithToast;
|
|
|
|
public ForgotPasswordForm $form;
|
|
|
|
public function sendLink(): void
|
|
{
|
|
$this->form->validate();
|
|
|
|
$status = Password::sendResetLink(['email' => $this->form->email]);
|
|
|
|
if ($status === Password::RESET_LINK_SENT) {
|
|
$this->toast(__($status), 'Berhasil');
|
|
$this->form->reset();
|
|
} else {
|
|
$this->toast(__($status), 'Gagal', 'danger');
|
|
}
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.auth.forgot-password');
|
|
}
|
|
}
|