An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: smtp view
Andras Bacsai019670d5d1ad
diff --git a/app/Http/Livewire/Notifications/DiscordSettings.php b/app/Http/Livewire/Notifications/DiscordSettings.phpindex 97a8878f17..800addc24d 100644--- a/app/Http/Livewire/Notifications/DiscordSettings.php+++ b/app/Http/Livewire/Notifications/DiscordSettings.php@@ -46,9 +46,6 @@ class DiscordSettings extends Componentpublic function saveModel(){$this->team->save();- if (is_a($this->team, Team::class)) {- refreshSession();- }$this->emit('success', 'Settings saved.');}diff --git a/app/Http/Livewire/Notifications/EmailSettings.php b/app/Http/Livewire/Notifications/EmailSettings.phpindex 939b8bce03..5bbf846f4d 100644--- a/app/Http/Livewire/Notifications/EmailSettings.php+++ b/app/Http/Livewire/Notifications/EmailSettings.php@@ -110,9 +110,6 @@ class EmailSettings extends Componentpublic function saveModel(){$this->team->save();- if (is_a($this->team, Team::class)) {- refreshSession();- }$this->emit('success', 'Settings saved.');}public function submit()@@ -141,10 +138,11 @@ class EmailSettings extends Componenttry {$this->resetErrorBag();$this->validate([+ 'team.smtp_from_address' => 'required|email',+ 'team.smtp_from_name' => 'required','team.resend_api_key' => 'required']);$this->team->save();- refreshSession();$this->emit('success', 'Settings saved successfully.');} catch (\Throwable $e) {$this->team->resend_enabled = false;diff --git a/app/Http/Livewire/Notifications/TelegramSettings.php b/app/Http/Livewire/Notifications/TelegramSettings.phpindex 15dca14901..b0313e1fb4 100644--- a/app/Http/Livewire/Notifications/TelegramSettings.php+++ b/app/Http/Livewire/Notifications/TelegramSettings.php@@ -52,9 +52,6 @@ class TelegramSettings extends Componentpublic function saveModel(){$this->team->save();- if (is_a($this->team, Team::class)) {- refreshSession();- }$this->emit('success', 'Settings saved.');}diff --git a/app/Http/Livewire/Team/Form.php b/app/Http/Livewire/Team/Form.phpindex 212957e448..febbf33a3c 100644--- a/app/Http/Livewire/Team/Form.php+++ b/app/Http/Livewire/Team/Form.php@@ -27,7 +27,6 @@ class Form extends Component$this->validate();try {$this->team->save();- refreshSession();} catch (\Throwable $e) {return general_error_handler($e, $this);}diff --git a/app/Models/Team.php b/app/Models/Team.phpindex 558c8dc3b7..e090796d5d 100644--- a/app/Models/Team.php+++ b/app/Models/Team.php@@ -19,6 +19,13 @@ class Team extends Model implements SendsDiscord, SendsEmail'resend_api_key' => 'encrypted',];+ protected static function booted()+ {+ static::saved(function () {+ refreshSession();+ });+ }+public function routeNotificationForDiscord(){return data_get($this, 'discord_webhook_url', null);diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex ffd429c580..39066e1b69 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -62,7 +62,11 @@ function showBoarding(): boolfunction refreshSession(?Team $team = null): void{if (!$team) {- $team = User::find(auth()->user()->id)->teams->first();+ if (auth()->user()->currentTeam()) {+ $team = Team::find(auth()->user()->currentTeam()->id);+ } else {+ $team = User::find(auth()->user()->id)->teams->first();+ }}Cache::forget('team:' . auth()->user()->id);Cache::remember('team:' . auth()->user()->id, 3600, function() use ($team) {diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.phpindex d7acaac1a2..d96eb4875e 100644--- a/resources/views/livewire/notifications/email-settings.blade.php+++ b/resources/views/livewire/notifications/email-settings.blade.php@@ -21,7 +21,8 @@Copy from Instance Settings</x-forms.button>@endif- @if (isEmailEnabled($team) && auth()->user()->isAdminFromSession())+ @if (isEmailEnabled($team) &&+ auth()->user()->isAdminFromSession())<x-forms.button onclick="sendTestEmail.showModal()"class="text-white normal-case btn btn-xs no-animation btn-primary">Send Test Email@@ -51,61 +52,52 @@</x-forms.button></form><div class="flex flex-col gap-4">- <details class="border rounded collapse border-coolgray-500 collapse-arrow ">- <summary class="text-xl collapse-title">- <div>SMTP Server</div>- <div class="w-32">- <x-forms.checkbox instantSave id="team.smtp_enabled" label="Enabled" />- </div>- </summary>- <div class="collapse-content">- <form wire:submit.prevent='submit' class="flex flex-col">- <div class="flex flex-col gap-4">- <div class="flex flex-col w-full gap-2 xl:flex-row">- <x-forms.input required id="team.smtp_host" placeholder="smtp.mailgun.org"- label="Host" />- <x-forms.input required id="team.smtp_port" placeholder="587" label="Port" />- <x-forms.input id="team.smtp_encryption" helper="If SMTP uses SSL, set it to 'tls'."- placeholder="tls" label="Encryption" />- </div>- <div class="flex flex-col w-full gap-2 xl:flex-row">- <x-forms.input id="team.smtp_username" label="SMTP Username" />- <x-forms.input id="team.smtp_password" type="password" label="SMTP Password" />- <x-forms.input id="team.smtp_timeout" helper="Timeout value for sending emails."- label="Timeout" />- </div>- </div>- <div class="flex justify-end gap-4 pt-6">- <x-forms.button type="submit">- Save- </x-forms.button>- </div>- </form>+ <div class="p-4 border border-coolgray-500">+ <h3>SMTP Server</h3>+ <div class="w-32">+ <x-forms.checkbox instantSave id="team.smtp_enabled" label="Enabled" /></div>- </details>- <details class="border rounded collapse border-coolgray-500 collapse-arrow">- <summary class="text-xl collapse-title">- <div>Resend</div>- <div class="w-32">- <x-forms.checkbox instantSave='instantSaveResend' id="team.resend_enabled" label="Enabled" />- </div>- </summary>- <div class="collapse-content">- <form wire:submit.prevent='submitResend' class="flex flex-col">- <div class="flex flex-col gap-4">- <div class="flex flex-col w-full gap-2 xl:flex-row">- <x-forms.input required type="password" id="team.resend_api_key" placeholder="API key"- label="API Key" />- </div>+ <form wire:submit.prevent='submit' class="flex flex-col">+ <div class="flex flex-col gap-4">+ <div class="flex flex-col w-full gap-2 xl:flex-row">+ <x-forms.input required id="team.smtp_host" placeholder="smtp.mailgun.org" label="Host" />+ <x-forms.input required id="team.smtp_port" placeholder="587" label="Port" />+ <x-forms.input id="team.smtp_encryption" helper="If SMTP uses SSL, set it to 'tls'."+ placeholder="tls" label="Encryption" /></div>- <div class="flex justify-end gap-4 pt-6">- <x-forms.button type="submit">- Save- </x-forms.button>+ <div class="flex flex-col w-full gap-2 xl:flex-row">+ <x-forms.input id="team.smtp_username" label="SMTP Username" />+ <x-forms.input id="team.smtp_password" type="password" label="SMTP Password" />+ <x-forms.input id="team.smtp_timeout" helper="Timeout value for sending emails."+ label="Timeout" /></div>- </form>+ </div>+ <div class="flex justify-end gap-4 pt-6">+ <x-forms.button type="submit">+ Save+ </x-forms.button>+ </div>+ </form>+ </div>+ <div class="p-4 border border-coolgray-500">+ <h3>Resend</h3>+ <div class="w-32">+ <x-forms.checkbox instantSave='instantSaveResend' id="team.resend_enabled" label="Enabled" /></div>- </details>+ <form wire:submit.prevent='submitResend' class="flex flex-col">+ <div class="flex flex-col gap-4">+ <div class="flex flex-col w-full gap-2 xl:flex-row">+ <x-forms.input required type="password" id="team.resend_api_key" placeholder="API key"+ label="API Key" />+ </div>+ </div>+ <div class="flex justify-end gap-4 pt-6">+ <x-forms.button type="submit">+ Save+ </x-forms.button>+ </div>+ </form>+ </div></div>@endif@if (isEmailEnabled($team) || data_get($team, 'use_instance_email_settings'))