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