laravel / jetstream

Tailwind scaffolding for the Laravel framework.
https://jetstream.laravel.com
MIT License
3.95k stars 809 forks source link

Activate/Deactivate 2FA and Update Password with autocompleted password on Safari fails #215

Closed OliverTe closed 3 years ago

OliverTe commented 4 years ago

On a fresh install of latest Laravel 8 with Jetstream (Livewire), there is a bug when activating/deactivating 2FA with Safari (Version 13.1.2 for Mac).

When activating/deactivating 2FA, the password has to be entered.

When the password is entered manually, the action is performed successfully after clicking "Confirm".

When the password is inserted via Safari password autocompletion and the "Confirm" button is pressed, the following error occurs: TypeError Argument 3 passed to Laravel\Fortify\Actions\ConfirmPassword::__invoke() must be of the type string, null given, called in /Users/XXX/XXX/XXX/vendor/laravel/jetstream/src/ConfirmsPasswords.php on line 75

The saved password in Safari is correct, it does not contain any problematic characters (password is "Laravel123").

==

Remark1: It seems that Livewire does not recognise autofilled/autocompleted passwords by Safari. A similar issue happens when using the "update password" function on the profile page. When entering the current password manually, it works. When auto-filling the current password by Safari, the error "The current password field is required." appears below the password input. It seems for Laravel/Jetstream/Livewire the Safari populated fields are considered as blank.

Remark2: When using autocompletion and adding a character to the end of the autofilled password (by typing it manually on the keyboard) and deleting the character again, the issues described above no longer appear.

Remark3: The login form works perfectly fine with autocompleted password. Looks like it is a Livewire issue, because the login form seems to be handled "traditionally" as a post request to the login route, whereas the update password and activate/deactive 2FA functions are handled by Livewire.

calebporzio commented 4 years ago

This is a known issue. I'll be looking into this shortly.

I'll report back here when it's fixed. Thanks!

calebporzio commented 4 years ago

Update on this: I've identified the problem. The solution should be rolled out some time next week.

driesvints commented 4 years ago

Thanks @calebporzio!

calebporzio commented 3 years ago

Ok, version v2.2.8 of Livewire should have this issue fixed.

Please run php artisan view:clear, update Livewire and confirm that this is fixed.

driesvints commented 3 years ago

Ping @OliverTe can you try Caleb's suggestion from above?

calebporzio commented 3 years ago

I did test locally, and I don't see the 2FA requiring a password, I DID try with logging out other browsers which DOES require a password and it worked great, just want to make sure the original issue is fixed.

OliverTe commented 3 years ago

@driesvints @calebporzio Can confirm the bug is fixed. Thanks Caleb!

Caleb, activating 2FA requires password only once. I guess the permission to activate then lives in the session. If you logout and login again, you should be asked for a password to activate 2FA.

calebporzio commented 3 years ago

Awesome! Thanks for following up!