In this episode, we're working on the password confirmation modal for our app. We'll start by putting together a basic form for the user to enter their password, and to make things quicker, we'll copy some input fields and button elements from our login form. After that, we wrap everything up in a form and make sure it posts to the correct route, which is user/confirm-password
. We use Laravel's Fortify routes here, so most of the wiring is already taken care of for us.
We test things by entering both incorrect and correct passwords, keeping an eye on the network tab to see the requests go through. You'll see what happens when the wrong password is provided (an error message shows up), and when the correct one is used, we get access to the dashboard as expected.
Afterward, we dive a little deeper into how password confirmation works behind the scenes. We look at the middleware in Laravel that handles this, specifically how you can customize the timeout for how long the password confirmation is valid. For development or for high-security situations, you can tweak this timeout really easily, which comes in handy if you want to keep seeing the confirmation modal repeatedly for testing, or make things more secure in production.
By the end, you'll have a working password confirmation modal that ties right in with your existing forms and authentication flow, setting us up nicely for even more security features, like two-factor authentication, in future episodes.