49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Auth;
|
|
|
|
use App\Livewire\Forms\Auth\ResetPasswordForm;
|
|
use App\Traits\Components\WithToast;
|
|
use Illuminate\Support\Facades\Password;
|
|
use Illuminate\View\View;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Attributes\Url;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('components.layouts.auth', [
|
|
'title' => 'Atur Ulang Kata Sandi',
|
|
])]
|
|
class ResetPassword extends Component
|
|
{
|
|
use WithToast;
|
|
|
|
public ResetPasswordForm $form;
|
|
|
|
#[Url]
|
|
public string $token = '';
|
|
|
|
#[Url]
|
|
public string $email = '';
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->form->setTokenAndEmail($this->token, $this->email);
|
|
}
|
|
|
|
public function resetPassword(): mixed
|
|
{
|
|
$status = $this->form->store();
|
|
|
|
return $status === Password::PasswordReset
|
|
? $this->redirectRoute('login', [
|
|
'message' => 'Kata sandi berhasil diperbarui, silakan masuk kembali.',
|
|
], navigate: true)
|
|
: $this->toast(__($status), 'Gagal', 'danger');
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.auth.reset-password');
|
|
}
|
|
}
|