Fortify and Livewire, customize the confirm password for 2FA

I’m deploying 2FA using Fortify in my project and I’m trying to customize the confirm password behavior using Livewire. I don’t want, when I click the Enable button, redirect me to ‘auth.passwords.confirm’ view. What I want is show this form in, for example, a modal that pop up on button clicked and this contain the password confirm form and can submit it. All this in the same component, so this way don’t need redirect even refresh page for this confirm. Somebody can tell me if its posible, and if its posible put me in the right way to do it?

Hey, @prospero

Yes you can do it easily, take a look at how jetstream modal works.

Take a look here

Hi @skywalker. Thanks for the suggest. I already have the blade view to confirm password provided by Jetstream that I can reuse and make a Livewire component. What I looking for too is the logic code behind this, and implement it in my component. I don’t want use at the twoFactorAuthentication feature confirm password set at true. If you see how this is made commonly, is throgh a form with ‘action=“user/two-factor-authentication”’, and after submit the browser is refreshed looking for the password.confirm blade view.
In that way I want implement my own password confirm component like Fortify does. For example, I want reuse in my component the ‘store’ method of ConfirmablePasswordController that will be executed just once in the same session and then call the enabled and disabled of the 2FA. And with this last one want the same, to reuse its methods in my Livewire component (the ‘store’ and ‘destroy’). Because I see how everybody or a lot of tutorials teach to able the Fortify features but I wanna learn how reuse that code and implemented on my own way in views. This is possible? How call the methods of other Controllers from a Livewire componet or how reuse them?

Hey, @prospero
Have you looked at JetStream ConfirmsPassword trait?

Understand how it works and use it in livewire component with confirm method inside your ConfirmsPassword livewire component.

That’s exactly what I needed!. Just a simple test function and I finish that here is the way! Don’t mean that I resolved at all my requirements, but now can put hands! Thx man, a lot!

1 Like

I’m Glade to hear that man!

I hope you can resolve your task/issue and if need any further assistance I am happy to help :smiley:

I finished the task and accomplished my requirements and taste! hahaha. Thanks to your help was possible, so thanks again man. I’m no doubt to contact you if I require any help. Thx

OH! That’s a good new to hear.

Yeah, I’m here if you need anything and happy coding :smiley: