Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -10,6 +10,7 @@ use App\Services\Auth\DisposableEmailService;
use App\Services\Auth\RegistrationVerificationTokenService;
use App\Services\Security\CaptchaVerifier;
use App\Services\Security\TurnstileVerifier;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
@@ -101,45 +102,47 @@ class RegisteredUserController extends Controller
$user = User::query()->where('email', $email)->first();
if ($user && $user->email_verified_at !== null) {
$this->logEmailEvent($email, $ip, (int) $user->id, 'blocked', 'already-verified');
return $this->redirectToRegisterNotice($email);
if ($user && $user->hasCompletedOnboarding()) {
return back()
->withInput($request->except('website'))
->withErrors(['email' => 'An account with this email already exists.']);
}
if (! $user) {
$user = User::query()->create([
$user = new User();
$user->forceFill([
'username' => null,
'name' => Str::before($email, '@'),
'email' => $email,
'password' => Hash::make(Str::random(64)),
'is_active' => false,
'onboarding_step' => 'email',
'is_active' => true,
'email_verified_at' => null,
'onboarding_step' => 'verified',
'needs_password_reset' => true,
'username_changed_at' => now(),
'last_username_change_at' => now(),
]);
$user->save();
} else {
$user->forceFill([
'email_verified_at' => $user->email_verified_at,
'is_active' => true,
'onboarding_step' => strtolower((string) ($user->onboarding_step ?? '')) === 'password' ? 'password' : 'verified',
'needs_password_reset' => strtolower((string) ($user->onboarding_step ?? '')) === 'password'
? (bool) $user->needs_password_reset
: true,
])->save();
}
if ($this->isWithinEmailCooldown($user)) {
$this->logEmailEvent($email, $ip, (int) $user->id, 'blocked', 'cooldown');
Auth::login($user);
return $this->redirectToRegisterNotice($email);
}
$needsPasswordSetup = strtolower((string) ($user->onboarding_step ?? '')) !== 'password'
|| (bool) $user->needs_password_reset;
$token = $this->verificationTokenService->createForUser((int) $user->id);
$event = $this->logEmailEvent($email, $ip, (int) $user->id, 'queued', null);
SendVerificationEmailJob::dispatch(
emailEventId: (int) $event->id,
email: $email,
token: $token,
userId: (int) $user->id,
ip: $ip
);
$this->markVerificationEmailSent($user);
return $this->redirectToRegisterNotice($email);
return redirect(route($needsPasswordSetup ? 'setup.password.create' : 'setup.username.create', absolute: false))
->with('status', $needsPasswordSetup
? 'Continue with password setup.'
: 'Continue with username setup.');
}
public function resendVerification(Request $request): RedirectResponse