Skip to content

Commit

Permalink
Merge pull request #26 from thedevdojo/jetstreamMods
Browse files Browse the repository at this point in the history
Adding functionality to handle 2fa on and off in jetstream
  • Loading branch information
tnylea authored May 30, 2024
2 parents 4b5700b + dd7d192 commit 518e69e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Devdojo\Auth\Http\Middleware\TwoFactorChallenged;
use Devdojo\Auth\Http\Middleware\TwoFactorEnabled;
use Devdojo\Auth\Http\Middleware\ViewAuthSetup;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
Expand Down Expand Up @@ -78,7 +79,7 @@ public function boot(): void
Livewire::component('auth.setup.css', \Devdojo\Auth\Livewire\Setup\Css::class);
}

//app()->register(\October\Rain\Config\ServiceProvider::class);
$this->handleStarterKitFunctionality();
}

private function registerAuthFolioDirectory(): void
Expand All @@ -100,6 +101,26 @@ private function registerVoltDirectory(): void
]);
}

private function handleStarterKitFunctionality()
{
$this->jetstreamFunctionality();
}

private function jetstreamFunctionality()
{
// We check if fortify is installed and the user has enabled 2FA, if so we want to enable that feature
if (class_exists(\Laravel\Fortify\Features::class) && config('devdojo.auth.settings.enable_2fa')) {
Config::set('fortify.features', array_merge(
Config::get('fortify.features', []),
[
\Laravel\Fortify\Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
]
));
}
}

/**
* Register the application services.
*/
Expand Down

0 comments on commit 518e69e

Please sign in to comment.