forgot-password.blade.php (1865B)
1 <?php 2 3 use Illuminate\Support\Facades\Password; 4 use Livewire\Attributes\Layout; 5 use Livewire\Attributes\Rule; 6 use Livewire\Volt\Component; 7 8 new #[Layout('layouts.guest')] class extends Component 9 { 10 #[Rule(['required', 'string', 'email'])] 11 public string $email = ''; 12 13 public function sendPasswordResetLink(): void 14 { 15 $this->validate(); 16 17 // We will send the password reset link to this user. Once we have attempted 18 // to send the link, we will examine the response then see the message we 19 // need to show to the user. Finally, we'll send out a proper response. 20 $status = Password::sendResetLink( 21 $this->only('email') 22 ); 23 24 if ($status != Password::RESET_LINK_SENT) { 25 $this->addError('email', __($status)); 26 27 return; 28 } 29 30 $this->reset('email'); 31 32 session()->flash('status', __($status)); 33 } 34 }; ?> 35 36 <div> 37 <div class="mb-4 text-sm text-gray-600 dark:text-gray-400"> 38 {{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }} 39 </div> 40 41 <!-- Session Status --> 42 <x-auth-session-status class="mb-4" :status="session('status')" /> 43 44 <form wire:submit="sendPasswordResetLink"> 45 <!-- Email Address --> 46 <div> 47 <x-input-label for="email" :value="__('Email')" /> 48 <x-text-input wire:model="email" id="email" class="block mt-1 w-full" type="email" name="email" required autofocus /> 49 <x-input-error :messages="$errors->get('email')" class="mt-2" /> 50 </div> 51 52 <div class="flex items-center justify-end mt-4"> 53 <x-primary-button> 54 {{ __('Email Password Reset Link') }} 55 </x-primary-button> 56 </div> 57 </form> 58 </div>