2026-01-20 19:53:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
|
|
2026-03-31 00:18:07 +00:00
|
|
|
use App\Actions\User\CreateUser;
|
2026-01-20 19:53:54 +00:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Models\User;
|
2026-03-29 22:24:28 +00:00
|
|
|
use App\Rules\Timezone;
|
2026-01-20 19:53:54 +00:00
|
|
|
use Illuminate\Auth\Events\Registered;
|
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
use Illuminate\Validation\Rules;
|
|
|
|
|
use Inertia\Inertia;
|
|
|
|
|
use Inertia\Response;
|
|
|
|
|
|
|
|
|
|
class RegisteredUserController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function create(Request $request): Response
|
|
|
|
|
{
|
|
|
|
|
return Inertia::render('auth/Register', [
|
|
|
|
|
'email' => $request->query('email'),
|
|
|
|
|
'redirect' => $request->query('redirect'),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function store(Request $request): RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
$request->validate([
|
|
|
|
|
'name' => ['required', 'string', 'max:255'],
|
|
|
|
|
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
|
|
|
|
|
'password' => ['required', Rules\Password::defaults()],
|
2026-03-29 20:26:27 +00:00
|
|
|
'timezone' => ['nullable', 'string', new Timezone],
|
2026-01-20 19:53:54 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$isInviteRegistration = str_contains($request->input('redirect', ''), '/invites/');
|
|
|
|
|
|
2026-03-31 00:18:07 +00:00
|
|
|
$user = CreateUser::execute([
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'email' => $request->email,
|
|
|
|
|
'password' => $request->password,
|
|
|
|
|
'timezone' => $request->input('timezone', 'UTC'),
|
|
|
|
|
'is_invite' => $isInviteRegistration,
|
|
|
|
|
]);
|
2026-01-20 19:53:54 +00:00
|
|
|
|
|
|
|
|
event(new Registered($user));
|
|
|
|
|
|
|
|
|
|
Auth::login($user);
|
|
|
|
|
|
|
|
|
|
if ($redirect = $request->input('redirect')) {
|
2026-03-30 17:58:25 +00:00
|
|
|
if (str_starts_with($redirect, '/') && ! str_starts_with($redirect, '//')) {
|
|
|
|
|
return redirect($redirect);
|
|
|
|
|
}
|
2026-01-20 19:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
refactor: auth split layout, subscribe redesign, onboarding, i18n, cookie locale
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
2026-03-30 14:53:42 +00:00
|
|
|
return redirect()->route('app.onboarding.role');
|
2026-01-20 19:53:54 +00:00
|
|
|
}
|
|
|
|
|
}
|