Closed oltdaniel closed 6 months ago
Following...
I don't know if it's related, but I can access and enable 2FA, but even when I configure the QRcode correctly when typing the generated code, I always receive the message "The provided two factor authentication code was invalid."
I can reproduce this. Sail doesn't matter, I've reproduced this on a fresh laravel app. I really wonder what's going on because by default 2FA is enabled through the fortify config with Features::twoFactorAuthentication
. So this really shouldn't happen...
Would appreciate any insight here.
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
Can confirm this happens when clicking 'cancel' as well
Unclear why this is happening, the fortify config is in place with 'confirm' set to true at the point of install when the message about migrations being added pops up asking if it should run those.
Starting tinker in another terminal while that prompt is awaiting response, I'm able to verify that Fortify::confirmsTwoFactorAuthentication()
returns true, so that field should appropriately be added to the user table, however it does not get added. The workaround right now is to do a subsequent php artisan migrate:fresh
I wonder how necessary it really is to only conditionally include that confirmation date field in the user table, sure if someone weren't using confirmation (not the default) that field isn't necessary, but since it's nullable anyway, does it really hurt anything to just include it regardless? That obviously is more of a fortify issue..
I tried adding var_dump(config('fortify-options')); before this line and it returned null. It is still unclear why it does that, though. I tried adding var_dump before and sometimes it returned the value as expected, but before this step it always returns null.
Executing the "migrate:fresh" command in another process fixed the issue. So instead of following.
$this->call('migrate:fresh', ['--force' => true]);
I tried following and it works.
(new Process([$this->phpBinary(), 'artisan', 'migrate:fresh', '--force'], base_path()))
->setTimeout(null)
->run(function ($type, $output) {
$this->output->write($output);
});
That makes sense. Like how tinker is unaware of changes to config or code without being restarted.
The new process method seems like an appropriate solution... Albeit a bit ugly
Jetstream Version
5.0.5
Jetstream Stack
Livewire
Laravel Version
11.6.0
PHP Version
8.3.6
Database Driver & Version
No response
Description
Jetstream uses Fortify for the 2FA feature and the 2FA confirmation is enabled by default when installed. The affected column here checks that feature for the migration as follows:
If you confirm to migrate the new migrations during the installation of jetstream, this somehow fails and causes this column to be missing in the database, causing queries that expect this column to exist to fail. If you execute the command
sail artisan migrate
after the installation of jetstream is done, everything works as expected.Steps To Reproduce
curl -s "https://laravel.build/project001?with=pgsql,redis,meilisearch,mailpit,minio" | bash
(less features shouldn't make a difference)sail up
sail composer require laravel/jetstream
sail php artisan jetstream:install livewire --teams
NOTE: Confirm to run migrations when asked to.two_factor_confirmed_at
.