forgot-password.blade.php 1.9 KB

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