fix: routing, switch back to old one

This commit is contained in:
Andras Bacsai
2023-12-27 16:45:01 +01:00
parent 8c20c833ba
commit f03aa57758
70 changed files with 961 additions and 322 deletions

View File

@@ -7,6 +7,7 @@ use App\Actions\Database\StartPostgresql;
use App\Actions\Database\StartRedis;
use App\Actions\Service\StartService;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Visus\Cuid2\Cuid2;
@@ -110,7 +111,7 @@ Route::middleware(['throttle:5'])->group(function () {
$token = request()->token;
$email = decrypt($token);
if (!User::whereEmail($email)->exists()) {
return redirect('/');
return redirect(RouteServiceProvider::HOME);
}
if (User::whereEmail($email)->first()->marketing_emails === false) {
return 'You have already unsubscribed from marketing emails.';

View File

@@ -32,6 +32,7 @@ use App\Models\PrivateKey;
use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\SwarmDocker;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
@@ -47,7 +48,7 @@ if (isDev()) {
Route::get('/api/v1/test/realtime', function () {
if (auth()->user()?->currentTeam()->id !== 0) {
return redirect('/');
return redirect(RouteServiceProvider::HOME);
}
TestEvent::dispatch('asd');
return 'Look at your other tab.';
@@ -89,7 +90,7 @@ Route::get('/verify', function () {
Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
$request->fulfill();
send_internal_notification("User {$request->user()->name} verified their email address.");
return redirect('/');
return redirect(RouteServiceProvider::HOME);
})->middleware(['auth'])->name('verify.verify');
Route::middleware(['throttle:login'])->group(function () {
@@ -243,7 +244,7 @@ Route::middleware(['auth'])->group(function () {
Route::any('/{any}', function () {
if (auth()->user()) {
return redirect('/');
return redirect(RouteServiceProvider::HOME);
}
return redirect('/login');
return redirect()->route('login');
})->where('any', '.*');