user(); if ($user->must_change_password_on_next_login) { return to_route('password.force-change.edit'); } $props = [ 'canManageTwoFactor' => Features::canManageTwoFactorAuthentication(), 'mustChangePassword' => (bool) $user->must_change_password_on_next_login, 'status' => session('status'), ]; if (Features::canManageTwoFactorAuthentication()) { $request->ensureStateIsValid(); $props['twoFactorEnabled'] = $user->hasEnabledTwoFactorAuthentication(); $props['requiresConfirmation'] = Features::optionEnabled(Features::twoFactorAuthentication(), 'confirm'); } return Inertia::render('settings/Security', $props); } /** * Show the dedicated forced password change page. */ public function editForcedPassword(Request $request): Response|RedirectResponse { if (! $request->user()->must_change_password_on_next_login) { return to_route('dashboard'); } return Inertia::render('auth/ForcePasswordChange', [ 'status' => session('status'), ]); } /** * Update the user's password. */ public function update(PasswordUpdateRequest $request): RedirectResponse { $user = $request->user(); $mustChangePassword = (bool) $user->must_change_password_on_next_login; $user->update([ 'must_change_password_on_next_login' => false, 'password' => $request->password, ]); if ($mustChangePassword) { return redirect()->intended(route('dashboard')); } return back(); } }