fix a few things

This commit is contained in:
Andras Bacsai
2023-09-01 09:34:25 +02:00
parent e74efc4e76
commit 3fabff93f6
8 changed files with 34 additions and 28 deletions

View File

@@ -5,11 +5,9 @@ namespace App\Http\Controllers;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
use App\Models\Project; use App\Models\Project;
use App\Models\S3Storage; use App\Models\S3Storage;
use App\Models\Server;
use App\Models\StandalonePostgresql; use App\Models\StandalonePostgresql;
use App\Models\TeamInvitation; use App\Models\TeamInvitation;
use App\Models\User; use App\Models\User;
use App\Models\Waitlist;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
@@ -19,12 +17,6 @@ class Controller extends BaseController
{ {
use AuthorizesRequests, ValidatesRequests; use AuthorizesRequests, ValidatesRequests;
public function waitlist() {
$waiting_in_line = Waitlist::whereVerified(true)->count();
return view('auth.waitlist', [
'waiting_in_line' => $waiting_in_line,
]);
}
public function subscription() public function subscription()
{ {
if (!isCloud()) { if (!isCloud()) {

View File

@@ -6,7 +6,6 @@ use App\Models\Project;
use App\Models\S3Storage; use App\Models\S3Storage;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;
use Log;
class Dashboard extends Component class Dashboard extends Component
{ {

View File

@@ -1,22 +1,27 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Http\Livewire\Waitlist;
use App\Jobs\SendConfirmationForWaitlistJob; use App\Jobs\SendConfirmationForWaitlistJob;
use App\Models\User; use App\Models\User;
use App\Models\Waitlist as ModelsWaitlist; use App\Models\Waitlist;
use Livewire\Component; use Livewire\Component;
class Waitlist extends Component class Index extends Component
{ {
public string $email; public string $email;
public int $waiting_in_line = 0; public int $waitingInLine = 0;
protected $rules = [ protected $rules = [
'email' => 'required|email', 'email' => 'required|email',
]; ];
public function render()
{
return view('livewire.waitlist.index')->layout('layouts.simple');
}
public function mount() public function mount()
{ {
$this->waitingInLine = Waitlist::whereVerified(true)->count();
if (isDev()) { if (isDev()) {
$this->email = 'waitlist@example.com'; $this->email = 'waitlist@example.com';
} }
@@ -29,7 +34,7 @@ class Waitlist extends Component
if ($already_registered) { if ($already_registered) {
throw new \Exception('You are already on the waitlist or registered. <br>Please check your email to verify your email address or contact support.'); throw new \Exception('You are already on the waitlist or registered. <br>Please check your email to verify your email address or contact support.');
} }
$found = ModelsWaitlist::where('email', $this->email)->first(); $found = Waitlist::where('email', $this->email)->first();
if ($found) { if ($found) {
if (!$found->verified) { if (!$found->verified) {
$this->emit('error', 'You are already on the waitlist. <br>Please check your email to verify your email address.'); $this->emit('error', 'You are already on the waitlist. <br>Please check your email to verify your email address.');
@@ -38,7 +43,7 @@ class Waitlist extends Component
$this->emit('error', 'You are already on the waitlist. <br>You will be notified when your turn comes. <br>Thank you.'); $this->emit('error', 'You are already on the waitlist. <br>You will be notified when your turn comes. <br>Thank you.');
return; return;
} }
$waitlist = ModelsWaitlist::create([ $waitlist = Waitlist::create([
'email' => $this->email, 'email' => $this->email,
'type' => 'registration', 'type' => 'registration',
]); ]);

View File

@@ -43,22 +43,16 @@ class FortifyServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
Fortify::createUsersUsing(CreateNewUser::class); Fortify::createUsersUsing(CreateNewUser::class);
Fortify::registerView(function () { Fortify::registerView(function () {
$settings = InstanceSettings::get(); $settings = InstanceSettings::get();
$waiting_in_line = Waitlist::whereVerified(true)->count();
if (!$settings->is_registration_enabled) { if (!$settings->is_registration_enabled) {
return redirect()->route('login'); return redirect()->route('login');
} }
if (config('coolify.waitlist')) { if (config('coolify.waitlist')) {
return view('auth.waitlist',[ return redirect()->route('waitlist.index');
'waiting_in_line' => $waiting_in_line,
]);
} else { } else {
return view('auth.register',[ return view('auth.register');
'waiting_in_line' => $waiting_in_line,
]);
} }
}); });

View File

@@ -1,3 +0,0 @@
<x-layout-simple>
<livewire:waitlist :waiting_in_line="$waiting_in_line" />
</x-layout-simple>

View File

@@ -192,6 +192,15 @@
</svg> </svg>
Basic Support Basic Support
</li> </li>
<li class="flex gap-x-3">
<svg class="flex-none w-5 h-6 text-warning" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
clip-rule="evenodd" />
</svg>
Included Email System
</li>
<li class="flex font-bold text-white gap-x-3"> <li class="flex font-bold text-white gap-x-3">
<svg width="512" height="512" class="flex-none w-5 h-6 text-green-600" <svg width="512" height="512" class="flex-none w-5 h-6 text-green-600"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@@ -250,6 +259,15 @@
</svg> </svg>
Priority Support Priority Support
</li> </li>
<li class="flex gap-x-3">
<svg class="flex-none w-5 h-6 text-warning" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
clip-rule="evenodd" />
</svg>
Included Email System
</li>
<li class="flex font-bold text-white gap-x-3"> <li class="flex font-bold text-white gap-x-3">
<svg width="512" height="512" class="flex-none w-5 h-6 text-green-600" <svg width="512" height="512" class="flex-none w-5 h-6 text-green-600"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">

View File

@@ -23,7 +23,7 @@
<x-forms.input id="email" type="email" label="Email" placeholder="youareawesome@protonmail.com" /> <x-forms.input id="email" type="email" label="Email" placeholder="youareawesome@protonmail.com" />
<x-forms.button type="submit">Join Waitlist</x-forms.button> <x-forms.button type="submit">Join Waitlist</x-forms.button>
</form> </form>
Waiting in the line: <span class="font-bold text-warning">{{ $waiting_in_line }}</span> Waiting in the line: <span class="font-bold text-warning">{{ $waitingInLine }}</span>
<div class="pt-4"> <div class="pt-4">
See the pricing <a href="https://coolify.io/pricing" class="text-warning">here</a>. See the pricing <a href="https://coolify.io/pricing" class="text-warning">here</a>.
</div> </div>

View File

@@ -11,6 +11,7 @@ use App\Http\Livewire\Boarding\Server as BoardingServer;
use App\Http\Livewire\Dashboard; use App\Http\Livewire\Dashboard;
use App\Http\Livewire\Server\All; use App\Http\Livewire\Server\All;
use App\Http\Livewire\Server\Show; use App\Http\Livewire\Server\Show;
use App\Http\Livewire\Waitlist\Index as WaitlistIndex;
use App\Models\GithubApp; use App\Models\GithubApp;
use App\Models\GitlabApp; use App\Models\GitlabApp;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
@@ -46,7 +47,7 @@ Route::post('/forgot-password', function (Request $request) {
} }
return response()->json(['message' => 'Transactional emails are not active'], 400); return response()->json(['message' => 'Transactional emails are not active'], 400);
})->name('password.forgot'); })->name('password.forgot');
Route::get('/waitlist', [Controller::class, 'waitlist'])->name('auth.waitlist'); Route::get('/waitlist', WaitlistIndex::class)->name('waitlist.index');
Route::prefix('magic')->middleware(['auth'])->group(function () { Route::prefix('magic')->middleware(['auth'])->group(function () {
Route::get('/servers', [MagicController::class, 'servers']); Route::get('/servers', [MagicController::class, 'servers']);