mehr übersetzungen, added pending purchase indicator. datenschutzfenster funktioniert.
This commit is contained in:
@@ -24,14 +24,16 @@ class MarketingRegisterController extends Controller
|
||||
/**
|
||||
* Show the registration page.
|
||||
*/
|
||||
public function create(Request $request, $package_id = null): Response
|
||||
public function create(Request $request): Response
|
||||
{
|
||||
$package_id = $request->query('package_id');
|
||||
$package = $package_id ? Package::find($package_id) : null;
|
||||
|
||||
//App::setLocale('de');
|
||||
$privacyHtml = view('legal.datenschutz-partial')->render();
|
||||
|
||||
return Inertia::render('auth/register', [
|
||||
'package' => $package,
|
||||
'privacyHtml' => $privacyHtml,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -65,8 +67,13 @@ class MarketingRegisterController extends Controller
|
||||
'phone' => $validated['phone'],
|
||||
'password' => Hash::make($validated['password']),
|
||||
'role' => 'user',
|
||||
'pending_purchase' => !empty($validated['package_id']),
|
||||
]);
|
||||
|
||||
if ($user->pending_purchase) {
|
||||
session()->put('pending_user_id', $user->id);
|
||||
}
|
||||
|
||||
if ($shouldAutoVerify) {
|
||||
$user->forceFill(['email_verified_at' => now()])->save();
|
||||
}
|
||||
@@ -113,6 +120,7 @@ class MarketingRegisterController extends Controller
|
||||
$package = Package::find($validated['package_id']);
|
||||
if (!$package) {
|
||||
// No action if package not found
|
||||
return redirect()->route('dashboard')->with('success', 'Registrierung erfolgreich! Bitte verifizieren Sie Ihre E-Mail.');
|
||||
} else if ((float) $package->price <= 0.0) {
|
||||
// Assign free package
|
||||
TenantPackage::create([
|
||||
@@ -133,20 +141,28 @@ class MarketingRegisterController extends Controller
|
||||
|
||||
$tenant->update(['subscription_status' => 'active']);
|
||||
|
||||
$user->update(['role' => 'tenant_admin']);
|
||||
$user->update(['role' => 'tenant_admin', 'pending_purchase' => false]);
|
||||
Auth::login($user); // Re-login to refresh session
|
||||
|
||||
if ($shouldAutoVerify) {
|
||||
return redirect()->route('dashboard')->with('success', 'Registrierung und Package-Zuweisung erfolgreich!');
|
||||
} else {
|
||||
return redirect()->route('verification.notice')->with('status', 'registration-success');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('buy.packages', $package->id);
|
||||
// For paid package, keep pending_purchase true, redirect to buy
|
||||
return redirect()->route('buy.packages', $package->id)->with('success', 'Registrierung erfolgreich! Fahren Sie mit dem Kauf fort.');
|
||||
}
|
||||
}
|
||||
|
||||
// No package
|
||||
if ($shouldAutoVerify) {
|
||||
return Inertia::location($dashboardUrl);
|
||||
return redirect()->route('dashboard')->with('success', 'Registrierung erfolgreich!');
|
||||
}
|
||||
|
||||
session()->flash('status', 'registration-success');
|
||||
|
||||
return Inertia::location(route('verification.notice'));
|
||||
return redirect()->route('verification.notice');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user