Auth pages: - Create AuthSplitLayout with animated feature slides (6 slides, 3 languages) - All auth pages use split layout (form left, visual right) - Add show/hide password toggle with tooltip on Register - Legal footer only shown on Register via showLegal prop Subscribe page: - Redesign to match auth card pattern (centered, clean) - Platform icons, feature checklist, dynamic trial days (trialDays - 1) - Add "Switch workspace" link - Full i18n (en, es, pt-BR) Onboarding: - Rename URLs: step1 -> role, step2 -> connect - Add enforceStep() to prevent skipping/going back steps - Redirect /onboarding to /onboarding/role - Redesign Step2 with AuthSplitLayout and compact platform list - 21 tests covering all step enforcement scenarios Workspaces page: - Redesign with AuthSplitLayout (list with avatars, current badge) Language system: - Move locale from DB to cookie (forever, unencrypted, session.domain) - Create SetLocale middleware (sets cookie if missing, validates against config) - Rename lang/pt-br to lang/pt-BR - Add dayjs es locale Other: - Copy utils.ts from sendkit (formatNumber, formatMoney, copyToClipboard) - ConfirmDeleteModal with text confirmation (sendkit pattern) - i18n for ConfirmDeleteModal internal strings (common.php) - EmptyState component for posts index - Exact match for "All" posts in sidebar - Posts breadcrumbs show current status filter - DialogFooter buttons aligned left - API Keys page redesign with Table, DropdownMenu, EmptyState - Extract CreateApiKeyDialog and InviteMemberDialog to components - Remove API Keys from sidebar - DropdownMenuItem destructive variant for Remove action
57 lines
1.7 KiB
PHP
57 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Middleware\App;
|
|
|
|
use App\Enums\User\Setup;
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class EnsureUserSetupIsComplete
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param Closure(Request): (Response) $next
|
|
*/
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
$user = $request->user();
|
|
|
|
if (! $user) {
|
|
return $next($request);
|
|
}
|
|
|
|
// If setup is completed, allow through
|
|
if ($user->setup === Setup::Completed) {
|
|
return $next($request);
|
|
}
|
|
|
|
// Map setup status to allowed routes
|
|
$allowedRoutes = match ($user->setup) {
|
|
Setup::Role => ['onboarding.role', 'onboarding.role.store'],
|
|
Setup::Connections => ['onboarding.connect', 'onboarding.connect.store', 'social.*'],
|
|
Setup::Subscription => ['onboarding.complete', 'onboarding.connect'],
|
|
default => ['onboarding.role', 'onboarding.role.store'],
|
|
};
|
|
|
|
$currentRoute = $request->route()?->getName();
|
|
|
|
// Check if current route is allowed
|
|
foreach ($allowedRoutes as $pattern) {
|
|
if ($currentRoute === $pattern || fnmatch($pattern, $currentRoute ?? '')) {
|
|
return $next($request);
|
|
}
|
|
}
|
|
|
|
// Redirect to appropriate step
|
|
return match ($user->setup) {
|
|
Setup::Role => redirect()->route('app.onboarding.role'),
|
|
Setup::Connections => redirect()->route('app.onboarding.connect'),
|
|
Setup::Subscription => redirect()->route('app.onboarding.connect'),
|
|
default => redirect()->route('app.onboarding.role'),
|
|
};
|
|
}
|
|
}
|