feat: harden identity and recovery operations

This commit is contained in:
2026-08-04 20:24:18 +01:00
parent 7a4ac48aaf
commit eae2a44f46
30 changed files with 1428 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\Settings\PasswordUpdateRequest;
use App\Http\Requests\Settings\TwoFactorAuthenticationRequest;
use App\Integrations\Microsoft\MicrosoftOidcClient;
use Illuminate\Http\RedirectResponse;
use Illuminate\Validation\Rules\Password;
use Inertia\Inertia;
@@ -16,8 +17,12 @@ class SecurityController extends Controller
/**
* Show the user's security settings page.
*/
public function edit(TwoFactorAuthenticationRequest $request): Response
public function edit(TwoFactorAuthenticationRequest $request, MicrosoftOidcClient $microsoft): Response
{
$microsoftIdentity = $request->user()
->externalIdentities()
->where('provider', 'microsoft')
->first();
$props = [
'canManageTwoFactor' => Features::canManageTwoFactorAuthentication(),
'canManagePasskeys' => Features::canManagePasskeys(),
@@ -38,6 +43,12 @@ class SecurityController extends Controller
->all()
: [],
'passwordRules' => Password::defaults()->toPasswordRulesString(),
'microsoft' => [
'enabled' => $microsoft->configured(),
'linked' => $microsoftIdentity !== null,
'email' => $microsoftIdentity?->provider_email,
'lastLoginAt' => $microsoftIdentity?->last_login_at?->toIso8601String(),
],
];
if (Features::canManageTwoFactorAuthentication()) {