fix: migrate db schema for smtp + discord
This commit is contained in:
parent
d0a85713d2
commit
9c393ff6bc
@ -10,26 +10,28 @@ class DiscordSettings extends Component
|
|||||||
{
|
{
|
||||||
public Team $model;
|
public Team $model;
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'model.discord.enabled' => 'nullable|boolean',
|
'model.discord_enabled' => 'nullable|boolean',
|
||||||
'model.discord.webhook_url' => 'required|url',
|
'model.discord_webhook_url' => 'required|url',
|
||||||
'model.discord_notifications.test' => 'nullable|boolean',
|
'model.discord_notifications_test' => 'nullable|boolean',
|
||||||
'model.discord_notifications.deployments' => 'nullable|boolean',
|
'model.discord_notifications_deployments' => 'nullable|boolean',
|
||||||
'model.discord_notifications.status_changes' => 'nullable|boolean',
|
'model.discord_notifications_status_changes' => 'nullable|boolean',
|
||||||
];
|
];
|
||||||
protected $validationAttributes = [
|
protected $validationAttributes = [
|
||||||
'model.discord.webhook_url' => 'Discord Webhook',
|
'model.discord_webhook_url' => 'Discord Webhook',
|
||||||
];
|
];
|
||||||
public function instantSave()
|
public function instantSave()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->model->discord->enabled = false;
|
ray($e->getMessage());
|
||||||
|
$this->model->discord_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function saveModel()
|
public function saveModel()
|
||||||
{
|
{
|
||||||
|
ray($this->model);
|
||||||
$this->model->save();
|
$this->model->save();
|
||||||
if (is_a($this->model, Team::class)) {
|
if (is_a($this->model, Team::class)) {
|
||||||
session(['currentTeam' => $this->model]);
|
session(['currentTeam' => $this->model]);
|
||||||
|
@ -12,37 +12,35 @@ class EmailSettings extends Component
|
|||||||
public Team $model;
|
public Team $model;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'model.smtp.enabled' => 'nullable|boolean',
|
'model.smtp_enabled' => 'nullable|boolean',
|
||||||
'model.smtp.from_address' => 'required|email',
|
'model.smtp_from_address' => 'required|email',
|
||||||
'model.smtp.from_name' => 'required',
|
'model.smtp_from_name' => 'required',
|
||||||
'model.smtp.recipients' => 'nullable',
|
'model.smtp_recipients' => 'nullable',
|
||||||
'model.smtp.host' => 'required',
|
'model.smtp_host' => 'required',
|
||||||
'model.smtp.port' => 'required',
|
'model.smtp_port' => 'required',
|
||||||
'model.smtp.encryption' => 'nullable',
|
'model.smtp_encryption' => 'nullable',
|
||||||
'model.smtp.username' => 'nullable',
|
'model.smtp_username' => 'nullable',
|
||||||
'model.smtp.password' => 'nullable',
|
'model.smtp_password' => 'nullable',
|
||||||
'model.smtp.timeout' => 'nullable',
|
'model.smtp_timeout' => 'nullable',
|
||||||
'model.smtp.test_recipients' => 'nullable',
|
'model.smtp_notifications_test' => 'nullable|boolean',
|
||||||
'model.smtp_notifications.test' => 'nullable|boolean',
|
'model.smtp_notifications_deployments' => 'nullable|boolean',
|
||||||
'model.smtp_notifications.deployments' => 'nullable|boolean',
|
'model.smtp_notifications_status_changes' => 'nullable|boolean',
|
||||||
'model.smtp_notifications.status_changes' => 'nullable|boolean',
|
|
||||||
];
|
];
|
||||||
protected $validationAttributes = [
|
protected $validationAttributes = [
|
||||||
'model.smtp.from_address' => 'From Address',
|
'model.smtp_from_address' => 'From Address',
|
||||||
'model.smtp.from_name' => 'From Name',
|
'model.smtp_from_name' => 'From Name',
|
||||||
'model.smtp.recipients' => 'Recipients',
|
'model.smtp_recipients' => 'Recipients',
|
||||||
'model.smtp.host' => 'Host',
|
'model.smtp_host' => 'Host',
|
||||||
'model.smtp.port' => 'Port',
|
'model.smtp_port' => 'Port',
|
||||||
'model.smtp.encryption' => 'Encryption',
|
'model.smtp_encryption' => 'Encryption',
|
||||||
'model.smtp.username' => 'Username',
|
'model.smtp_username' => 'Username',
|
||||||
'model.smtp.password' => 'Password',
|
'model.smtp_password' => 'Password',
|
||||||
'model.smtp.test_recipients' => 'Test Recipients',
|
|
||||||
];
|
];
|
||||||
private function decrypt()
|
private function decrypt()
|
||||||
{
|
{
|
||||||
if (data_get($this->model, 'smtp.password')) {
|
if (data_get($this->model, 'smtp_password')) {
|
||||||
try {
|
try {
|
||||||
$this->model->smtp->password = decrypt($this->model->smtp->password);
|
$this->model->smtp_password = decrypt($this->model->smtp_password);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,18 +52,17 @@ public function mount()
|
|||||||
public function copyFromInstanceSettings()
|
public function copyFromInstanceSettings()
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
if ($settings->smtp->enabled) {
|
if ($settings->smtp_enabled) {
|
||||||
$this->model->smtp->enabled = true;
|
$this->model->smtp_enabled = true;
|
||||||
$this->model->smtp->from_address = $settings->smtp->from_address;
|
$this->model->smtp_from_address = $settings->smtp_from_address;
|
||||||
$this->model->smtp->from_name = $settings->smtp->from_name;
|
$this->model->smtp_from_name = $settings->smtp_from_name;
|
||||||
$this->model->smtp->recipients = $settings->smtp->recipients;
|
$this->model->smtp_recipients = $settings->smtp_recipients;
|
||||||
$this->model->smtp->host = $settings->smtp->host;
|
$this->model->smtp_host = $settings->smtp_host;
|
||||||
$this->model->smtp->port = $settings->smtp->port;
|
$this->model->smtp_port = $settings->smtp_port;
|
||||||
$this->model->smtp->encryption = $settings->smtp->encryption;
|
$this->model->smtp_encryption = $settings->smtp_encryption;
|
||||||
$this->model->smtp->username = $settings->smtp->username;
|
$this->model->smtp_username = $settings->smtp_username;
|
||||||
$this->model->smtp->password = $settings->smtp->password;
|
$this->model->smtp_password = $settings->smtp_password;
|
||||||
$this->model->smtp->timeout = $settings->smtp->timeout;
|
$this->model->smtp_timeout = $settings->smtp_timeout;
|
||||||
$this->model->smtp->test_recipients = $settings->smtp->test_recipients;
|
|
||||||
$this->saveModel();
|
$this->saveModel();
|
||||||
} else {
|
} else {
|
||||||
$this->emit('error', 'Instance SMTP settings are not enabled.');
|
$this->emit('error', 'Instance SMTP settings are not enabled.');
|
||||||
@ -76,14 +73,13 @@ public function submit()
|
|||||||
$this->resetErrorBag();
|
$this->resetErrorBag();
|
||||||
$this->validate();
|
$this->validate();
|
||||||
|
|
||||||
if ($this->model->smtp->password) {
|
if ($this->model->smtp_password) {
|
||||||
$this->model->smtp->password = encrypt($this->model->smtp->password);
|
$this->model->smtp_password = encrypt($this->model->smtp_password);
|
||||||
} else {
|
} else {
|
||||||
$this->model->smtp->password = null;
|
$this->model->smtp_password = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model->smtp->recipients = str_replace(' ', '', $this->model->smtp->recipients);
|
$this->model->smtp_recipients = str_replace(' ', '', $this->model->smtp_recipients);
|
||||||
$this->model->smtp->test_recipients = str_replace(' ', '', $this->model->smtp->test_recipients);
|
|
||||||
$this->saveModel();
|
$this->saveModel();
|
||||||
}
|
}
|
||||||
public function saveModel()
|
public function saveModel()
|
||||||
@ -105,7 +101,7 @@ public function instantSave()
|
|||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->model->smtp->enabled = false;
|
$this->model->smtp_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,27 +12,27 @@ class Email extends Component
|
|||||||
public InstanceSettings $settings;
|
public InstanceSettings $settings;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'settings.smtp.enabled' => 'nullable|boolean',
|
'settings.smtp_enabled' => 'nullable|boolean',
|
||||||
'settings.smtp.host' => 'required',
|
'settings.smtp_host' => 'required',
|
||||||
'settings.smtp.port' => 'required|numeric',
|
'settings.smtp_port' => 'required|numeric',
|
||||||
'settings.smtp.encryption' => 'nullable',
|
'settings.smtp_encryption' => 'nullable',
|
||||||
'settings.smtp.username' => 'nullable',
|
'settings.smtp_username' => 'nullable',
|
||||||
'settings.smtp.password' => 'nullable',
|
'settings.smtp_password' => 'nullable',
|
||||||
'settings.smtp.timeout' => 'nullable',
|
'settings.smtp_timeout' => 'nullable',
|
||||||
'settings.smtp.test_recipients' => 'nullable',
|
'settings.smtp_test_recipients' => 'nullable',
|
||||||
'settings.smtp.from_address' => 'required|email',
|
'settings.smtp_from_address' => 'required|email',
|
||||||
'settings.smtp.from_name' => 'required',
|
'settings.smtp_from_name' => 'required',
|
||||||
];
|
];
|
||||||
protected $validationAttributes = [
|
protected $validationAttributes = [
|
||||||
'settings.smtp.from_address' => 'From Address',
|
'settings.smtp_from_address' => 'From Address',
|
||||||
'settings.smtp.from_name' => 'From Name',
|
'settings.smtp_from_name' => 'From Name',
|
||||||
'settings.smtp.recipients' => 'Recipients',
|
'settings.smtp_recipients' => 'Recipients',
|
||||||
'settings.smtp.host' => 'Host',
|
'settings.smtp_host' => 'Host',
|
||||||
'settings.smtp.port' => 'Port',
|
'settings.smtp_port' => 'Port',
|
||||||
'settings.smtp.encryption' => 'Encryption',
|
'settings.smtp_encryption' => 'Encryption',
|
||||||
'settings.smtp.username' => 'Username',
|
'settings.smtp_username' => 'Username',
|
||||||
'settings.smtp.password' => 'Password',
|
'settings.smtp_password' => 'Password',
|
||||||
'settings.smtp.test_recipients' => 'Test Recipients',
|
'settings.smtp_test_recipients' => 'Test Recipients',
|
||||||
];
|
];
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
@ -44,7 +44,7 @@ public function instantSave()
|
|||||||
$this->submit();
|
$this->submit();
|
||||||
$this->emit('success', 'Settings saved successfully.');
|
$this->emit('success', 'Settings saved successfully.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->settings->smtp->enabled = false;
|
$this->settings->smtp_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,9 +55,9 @@ public function testNotification()
|
|||||||
}
|
}
|
||||||
private function decrypt()
|
private function decrypt()
|
||||||
{
|
{
|
||||||
if (data_get($this->settings, 'smtp.password')) {
|
if (data_get($this->settings, 'smtp_password')) {
|
||||||
try {
|
try {
|
||||||
$this->settings->smtp->password = decrypt($this->settings->smtp->password);
|
$this->settings->smtp_password = decrypt($this->settings->smtp_password);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,13 +66,12 @@ public function submit()
|
|||||||
{
|
{
|
||||||
$this->resetErrorBag();
|
$this->resetErrorBag();
|
||||||
$this->validate();
|
$this->validate();
|
||||||
if ($this->settings->smtp->password) {
|
if ($this->settings->smtp_password) {
|
||||||
$this->settings->smtp->password = encrypt($this->settings->smtp->password);
|
$this->settings->smtp_password = encrypt($this->settings->smtp_password);
|
||||||
} else {
|
} else {
|
||||||
$this->settings->smtp->password = null;
|
$this->settings->smtp_password = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->settings->smtp->test_recipients = str_replace(' ', '', $this->settings->smtp->test_recipients);
|
|
||||||
$this->settings->save();
|
$this->settings->save();
|
||||||
$this->emit('success', 'Transaction email settings updated successfully.');
|
$this->emit('success', 'Transaction email settings updated successfully.');
|
||||||
$this->decrypt();
|
$this->decrypt();
|
||||||
|
@ -7,26 +7,17 @@
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
|
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
|
||||||
use Spatie\SchemalessAttributes\SchemalessAttributesTrait;
|
|
||||||
|
|
||||||
class InstanceSettings extends Model implements SendsEmail
|
class InstanceSettings extends Model implements SendsEmail
|
||||||
{
|
{
|
||||||
use Notifiable, SchemalessAttributesTrait;
|
use Notifiable;
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
protected $schemalessAttributes = [
|
|
||||||
'smtp',
|
|
||||||
];
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'smtp' => SchemalessAttributes::class,
|
|
||||||
'resale_license' => 'encrypted',
|
'resale_license' => 'encrypted',
|
||||||
];
|
];
|
||||||
public function scopeWithSmtp(): Builder
|
|
||||||
{
|
|
||||||
return $this->smtp->modelScope();
|
|
||||||
}
|
|
||||||
public function routeNotificationForEmail(string $attribute = 'test_recipients')
|
public function routeNotificationForEmail(string $attribute = 'test_recipients')
|
||||||
{
|
{
|
||||||
$recipients = $this->smtp->get($attribute, '');
|
$recipients = data_get($this,'smtp','');
|
||||||
if (is_null($recipients) || $recipients === '') {
|
if (is_null($recipients) || $recipients === '') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -12,60 +12,26 @@
|
|||||||
|
|
||||||
class Team extends Model implements SendsDiscord, SendsEmail
|
class Team extends Model implements SendsDiscord, SendsEmail
|
||||||
{
|
{
|
||||||
use Notifiable, SchemalessAttributesTrait;
|
use Notifiable;
|
||||||
|
|
||||||
protected $schemalessAttributes = [
|
protected $guarded = [];
|
||||||
'smtp',
|
|
||||||
'discord',
|
|
||||||
'smtp_notifications',
|
|
||||||
'discord_notifications',
|
|
||||||
];
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'smtp' => SchemalessAttributes::class,
|
|
||||||
'discord' => SchemalessAttributes::class,
|
|
||||||
'smtp_notifications' => SchemalessAttributes::class,
|
|
||||||
'discord_notifications' => SchemalessAttributes::class,
|
|
||||||
'personal_team' => 'boolean',
|
'personal_team' => 'boolean',
|
||||||
];
|
];
|
||||||
public function scopeWithSmtp(): Builder
|
|
||||||
{
|
|
||||||
return $this->smtp->modelScope();
|
|
||||||
}
|
|
||||||
public function scopeWithDiscord(): Builder
|
|
||||||
{
|
|
||||||
return $this->discord->modelScope();
|
|
||||||
}
|
|
||||||
public function scopeWithSmtpNotifications(): Builder
|
|
||||||
{
|
|
||||||
return $this->smtp_notifications->modelScope();
|
|
||||||
}
|
|
||||||
public function scopeWithDiscordNotifications(): Builder
|
|
||||||
{
|
|
||||||
return $this->discord_notifications->modelScope();
|
|
||||||
}
|
|
||||||
protected $fillable = [
|
|
||||||
'id',
|
|
||||||
'name',
|
|
||||||
'description',
|
|
||||||
'personal_team',
|
|
||||||
'smtp',
|
|
||||||
'discord'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function routeNotificationForDiscord()
|
public function routeNotificationForDiscord()
|
||||||
{
|
{
|
||||||
return $this->discord->get('webhook_url');
|
return data_get($this, 'discord_webhook_url', null);
|
||||||
}
|
}
|
||||||
public function routeNotificationForEmail(string $attribute = 'recipients')
|
public function routeNotificationForEmail(string $attribute = 'recipients')
|
||||||
{
|
{
|
||||||
$recipients = $this->smtp->get($attribute, '');
|
$recipients = data_get($this, 'smtp_recipients', '');
|
||||||
if (is_null($recipients) || $recipients === '') {
|
if (is_null($recipients) || $recipients === '') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return explode(',', $recipients);
|
return explode(',', $recipients);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function subscription()
|
public function subscription()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Subscription::class);
|
return $this->hasOne(Subscription::class);
|
||||||
|
@ -34,20 +34,6 @@ protected static function boot()
|
|||||||
$team = [
|
$team = [
|
||||||
'name' => $user->name . "'s Team",
|
'name' => $user->name . "'s Team",
|
||||||
'personal_team' => true,
|
'personal_team' => true,
|
||||||
'smtp' => [
|
|
||||||
'enabled' => false,
|
|
||||||
],
|
|
||||||
'smtp_notifications' => [
|
|
||||||
'test' => true,
|
|
||||||
'deployments' => false,
|
|
||||||
],
|
|
||||||
'discord' => [
|
|
||||||
'enabled' => false,
|
|
||||||
],
|
|
||||||
'discord_notifications' => [
|
|
||||||
'test' => true,
|
|
||||||
'deployments' => false,
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
if ($user->id === 0) {
|
if ($user->id === 0) {
|
||||||
$team['id'] = 0;
|
$team['id'] = 0;
|
||||||
|
@ -24,8 +24,8 @@ public function send(SendsEmail $notifiable, Notification $notification): void
|
|||||||
[],
|
[],
|
||||||
fn (Message $message) => $message
|
fn (Message $message) => $message
|
||||||
->from(
|
->from(
|
||||||
data_get($notifiable, 'smtp.from_address'),
|
data_get($notifiable, 'smtp_from_address'),
|
||||||
data_get($notifiable, 'smtp.from_name'),
|
data_get($notifiable, 'smtp_from_name'),
|
||||||
)
|
)
|
||||||
->bcc($bcc)
|
->bcc($bcc)
|
||||||
->subject($mailMessage->subject)
|
->subject($mailMessage->subject)
|
||||||
@ -35,18 +35,18 @@ public function send(SendsEmail $notifiable, Notification $notification): void
|
|||||||
|
|
||||||
private function bootConfigs($notifiable): void
|
private function bootConfigs($notifiable): void
|
||||||
{
|
{
|
||||||
$password = data_get($notifiable, 'smtp.password');
|
$password = data_get($notifiable, 'smtp_password');
|
||||||
if ($password) $password = decrypt($password);
|
if ($password) $password = decrypt($password);
|
||||||
|
|
||||||
config()->set('mail.default', 'smtp');
|
config()->set('mail.default', 'smtp');
|
||||||
config()->set('mail.mailers.smtp', [
|
config()->set('mail.mailers.smtp', [
|
||||||
"transport" => "smtp",
|
"transport" => "smtp",
|
||||||
"host" => data_get($notifiable, 'smtp.host'),
|
"host" => data_get($notifiable, 'smtp_host'),
|
||||||
"port" => data_get($notifiable, 'smtp.port'),
|
"port" => data_get($notifiable, 'smtp_port'),
|
||||||
"encryption" => data_get($notifiable, 'smtp.encryption'),
|
"encryption" => data_get($notifiable, 'smtp_encryption'),
|
||||||
"username" => data_get($notifiable, 'smtp.username'),
|
"username" => data_get($notifiable, 'smtp_username'),
|
||||||
"password" => $password,
|
"password" => $password,
|
||||||
"timeout" => data_get($notifiable, 'smtp.timeout'),
|
"timeout" => data_get($notifiable, 'smtp_timeout'),
|
||||||
"local_domain" => null,
|
"local_domain" => null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class TransactionalEmailChannel
|
|||||||
public function send(User $notifiable, Notification $notification): void
|
public function send(User $notifiable, Notification $notification): void
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
if (data_get($settings, 'smtp.enabled') !== true) {
|
if (data_get($settings, 'smtp_enabled') !== true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$email = $notifiable->email;
|
$email = $notifiable->email;
|
||||||
@ -27,8 +27,8 @@ public function send(User $notifiable, Notification $notification): void
|
|||||||
[],
|
[],
|
||||||
fn (Message $message) => $message
|
fn (Message $message) => $message
|
||||||
->from(
|
->from(
|
||||||
data_get($settings, 'smtp.from_address'),
|
data_get($settings, 'smtp_from_address'),
|
||||||
data_get($settings, 'smtp.from_name')
|
data_get($settings, 'smtp_from_name')
|
||||||
)
|
)
|
||||||
->to($email)
|
->to($email)
|
||||||
->subject($mailMessage->subject)
|
->subject($mailMessage->subject)
|
||||||
|
@ -38,10 +38,10 @@ public function __construct(Application $application)
|
|||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
$channels = [];
|
$channels = [];
|
||||||
$isEmailEnabled = data_get($notifiable, 'smtp.enabled');
|
$isEmailEnabled = data_get($notifiable, 'smtp_enabled');
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord.enabled');
|
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
||||||
$isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications.status_changes');
|
$isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications_status_changes');
|
||||||
$isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications.status_changes');
|
$isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications_status_changes');
|
||||||
|
|
||||||
if ($isEmailEnabled && $isSubscribedToEmailEvent) {
|
if ($isEmailEnabled && $isSubscribedToEmailEvent) {
|
||||||
$channels[] = EmailChannel::class;
|
$channels[] = EmailChannel::class;
|
||||||
|
@ -43,10 +43,10 @@ public function __construct(Application $application, string $deployment_uuid, A
|
|||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
$channels = [];
|
$channels = [];
|
||||||
$isEmailEnabled = data_get($notifiable, 'smtp.enabled');
|
$isEmailEnabled = data_get($notifiable, 'smtp_enabled');
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord.enabled');
|
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
||||||
$isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications.deployments');
|
$isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications_deployments');
|
||||||
$isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications.deployments');
|
$isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications_deployments');
|
||||||
|
|
||||||
if ($isEmailEnabled && $isSubscribedToEmailEvent) {
|
if ($isEmailEnabled && $isSubscribedToEmailEvent) {
|
||||||
$channels[] = EmailChannel::class;
|
$channels[] = EmailChannel::class;
|
||||||
|
@ -44,10 +44,10 @@ public function __construct(Application $application, string $deployment_uuid, A
|
|||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
$channels = [];
|
$channels = [];
|
||||||
$isEmailEnabled = data_get($notifiable, 'smtp.enabled');
|
$isEmailEnabled = data_get($notifiable, 'smtp_enabled');
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord.enabled');
|
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
||||||
$isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications.deployments');
|
$isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications_deployments');
|
||||||
$isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications.deployments');
|
$isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications_deployments');
|
||||||
|
|
||||||
if ($isEmailEnabled && $isSubscribedToEmailEvent) {
|
if ($isEmailEnabled && $isSubscribedToEmailEvent) {
|
||||||
$channels[] = EmailChannel::class;
|
$channels[] = EmailChannel::class;
|
||||||
|
@ -23,8 +23,8 @@ public function via(object $notifiable): array
|
|||||||
|
|
||||||
$isSmtp = $this->type === 'smtp' || is_null($this->type);
|
$isSmtp = $this->type === 'smtp' || is_null($this->type);
|
||||||
$isDiscord = $this->type === 'discord' || is_null($this->type);
|
$isDiscord = $this->type === 'discord' || is_null($this->type);
|
||||||
$isEmailEnabled = data_get($notifiable, 'smtp.enabled');
|
$isEmailEnabled = data_get($notifiable, 'smtp_enabled');
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord.enabled');
|
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
||||||
|
|
||||||
if ($isEmailEnabled && $isSmtp) {
|
if ($isEmailEnabled && $isSmtp) {
|
||||||
$channels[] = EmailChannel::class;
|
$channels[] = EmailChannel::class;
|
||||||
|
@ -70,24 +70,24 @@ function generate_application_name(string $git_repository, string $git_branch)
|
|||||||
|
|
||||||
function is_transactional_emails_active()
|
function is_transactional_emails_active()
|
||||||
{
|
{
|
||||||
return data_get(InstanceSettings::get(), 'smtp.enabled');
|
return data_get(InstanceSettings::get(), 'smtp_enabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_transanctional_email_settings()
|
function set_transanctional_email_settings()
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
$password = data_get($settings, 'smtp.password');
|
$password = data_get($settings, 'smtp_password');
|
||||||
if ($password) $password = decrypt($password);
|
if ($password) $password = decrypt($password);
|
||||||
|
|
||||||
config()->set('mail.default', 'smtp');
|
config()->set('mail.default', 'smtp');
|
||||||
config()->set('mail.mailers.smtp', [
|
config()->set('mail.mailers.smtp', [
|
||||||
"transport" => "smtp",
|
"transport" => "smtp",
|
||||||
"host" => data_get($settings, 'smtp.host'),
|
"host" => data_get($settings, 'smtp_host'),
|
||||||
"port" => data_get($settings, 'smtp.port'),
|
"port" => data_get($settings, 'smtp_port'),
|
||||||
"encryption" => data_get($settings, 'smtp.encryption'),
|
"encryption" => data_get($settings, 'smtp_encryption'),
|
||||||
"username" => data_get($settings, 'smtp.username'),
|
"username" => data_get($settings, 'smtp_username'),
|
||||||
"password" => $password,
|
"password" => $password,
|
||||||
"timeout" => data_get($settings, 'smtp.timeout'),
|
"timeout" => data_get($settings, 'smtp_timeout'),
|
||||||
"local_domain" => null,
|
"local_domain" => null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public function up(): void
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('instancesettings', function (Blueprint $table) {
|
Schema::table('instance_settings', function (Blueprint $table) {
|
||||||
$table->string('wildcard_domain')->nullable();
|
$table->string('wildcard_domain')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,193 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\Models\Team;
|
||||||
|
use App\Models\InstanceSettings;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('teams', function (Blueprint $table) {
|
||||||
|
$table->boolean('smtp_enabled')->default(false);
|
||||||
|
$table->string('smtp_from_address')->nullable();
|
||||||
|
$table->string('smtp_from_name')->nullable();
|
||||||
|
$table->string('smtp_recipients')->nullable();
|
||||||
|
$table->string('smtp_host')->nullable();
|
||||||
|
$table->integer('smtp_port')->nullable();
|
||||||
|
$table->string('smtp_encryption')->nullable();
|
||||||
|
$table->string('smtp_username')->nullable();
|
||||||
|
$table->string('smtp_password')->nullable();
|
||||||
|
$table->integer('smtp_timeout')->nullable();
|
||||||
|
$table->boolean('smtp_notifications_test')->default(true);
|
||||||
|
$table->boolean('smtp_notifications_deployments')->default(false);
|
||||||
|
$table->boolean('smtp_notifications_status_changes')->default(false);
|
||||||
|
|
||||||
|
$table->boolean('discord_enabled')->default(false);
|
||||||
|
$table->string('discord_webhook_url')->nullable();
|
||||||
|
$table->boolean('discord_notifications_test')->default(true);
|
||||||
|
$table->boolean('discord_notifications_deployments')->default(true);
|
||||||
|
$table->boolean('discord_notifications_status_changes')->default(true);
|
||||||
|
});
|
||||||
|
$teams = Team::all();
|
||||||
|
foreach($teams as $team) {
|
||||||
|
$team->smtp_enabled = data_get($team, 'smtp.enabled', false);
|
||||||
|
$team->smtp_from_address = data_get($team, 'smtp.from_address');
|
||||||
|
$team->smtp_from_name = data_get($team, 'smtp.from_name');
|
||||||
|
$team->smtp_recipients = data_get($team, 'smtp.recipients');
|
||||||
|
$team->smtp_host = data_get($team, 'smtp.host');
|
||||||
|
$team->smtp_port = data_get($team, 'smtp.port');
|
||||||
|
$team->smtp_encryption = data_get($team, 'smtp.encryption');
|
||||||
|
$team->smtp_username = data_get($team, 'smtp.username');
|
||||||
|
$team->smtp_password = data_get($team, 'smtp.password');
|
||||||
|
$team->smtp_timeout = data_get($team, 'smtp.timeout');
|
||||||
|
$team->smtp_notifications_test = data_get($team, 'smtp_notifications.test',true);
|
||||||
|
$team->smtp_notifications_deployments = data_get($team, 'smtp_notifications.deployments',false);
|
||||||
|
$team->smtp_notifications_status_changes = data_get($team, 'smtp_notifications.status_changes',false);
|
||||||
|
|
||||||
|
$team->discord_enabled = data_get($team, 'discord.enabled', false);
|
||||||
|
$team->discord_webhook_url = data_get($team, 'discord.webhook_url');
|
||||||
|
$team->discord_notifications_test = data_get($team, 'discord_notifications.test',true);
|
||||||
|
$team->discord_notifications_deployments = data_get($team, 'discord_notifications.deployments',true);
|
||||||
|
$team->discord_notifications_status_changes = data_get($team, 'discord_notifications.status_changes',true);
|
||||||
|
|
||||||
|
$team->save();
|
||||||
|
}
|
||||||
|
Schema::table('teams', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('smtp');
|
||||||
|
$table->dropColumn('smtp_notifications');
|
||||||
|
$table->dropColumn('discord');
|
||||||
|
$table->dropColumn('discord_notifications');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('instance_settings', function (Blueprint $table) {
|
||||||
|
$table->boolean('smtp_enabled')->default(false);
|
||||||
|
$table->string('smtp_from_address')->nullable();
|
||||||
|
$table->string('smtp_from_name')->nullable();
|
||||||
|
$table->string('smtp_recipients')->nullable();
|
||||||
|
$table->string('smtp_host')->nullable();
|
||||||
|
$table->integer('smtp_port')->nullable();
|
||||||
|
$table->string('smtp_encryption')->nullable();
|
||||||
|
$table->string('smtp_username')->nullable();
|
||||||
|
$table->string('smtp_password')->nullable();
|
||||||
|
$table->integer('smtp_timeout')->nullable();
|
||||||
|
});
|
||||||
|
$instance_settings = InstanceSettings::all();
|
||||||
|
foreach($instance_settings as $instance_setting) {
|
||||||
|
$instance_setting->smtp_enabled = data_get($instance_setting, 'smtp.enabled', false);
|
||||||
|
$instance_setting->smtp_from_address = data_get($instance_setting, 'smtp.from_address');
|
||||||
|
$instance_setting->smtp_from_name = data_get($instance_setting, 'smtp.from_name');
|
||||||
|
$instance_setting->smtp_recipients = data_get($instance_setting, 'smtp.recipients');
|
||||||
|
$instance_setting->smtp_host = data_get($instance_setting, 'smtp.host');
|
||||||
|
$instance_setting->smtp_port = data_get($instance_setting, 'smtp.port');
|
||||||
|
$instance_setting->smtp_encryption = data_get($instance_setting, 'smtp.encryption');
|
||||||
|
$instance_setting->smtp_username = data_get($instance_setting, 'smtp.username');
|
||||||
|
$instance_setting->smtp_password = data_get($instance_setting, 'smtp.password');
|
||||||
|
$instance_setting->smtp_timeout = data_get($instance_setting, 'smtp.timeout');
|
||||||
|
$instance_setting->save();
|
||||||
|
}
|
||||||
|
Schema::table('instance_settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('smtp');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('teams', function (Blueprint $table) {
|
||||||
|
$table->schemalessAttributes('smtp');
|
||||||
|
$table->schemalessAttributes('smtp_notifications');
|
||||||
|
$table->schemalessAttributes('discord');
|
||||||
|
$table->schemalessAttributes('discord_notifications');
|
||||||
|
});
|
||||||
|
$teams = Team::all();
|
||||||
|
foreach($teams as $team) {
|
||||||
|
$team->smtp = [
|
||||||
|
'enabled' => $team->smtp_enabled,
|
||||||
|
'from_address' => $team->smtp_from_address,
|
||||||
|
'from_name' => $team->smtp_from_name,
|
||||||
|
'recipients' => $team->smtp_recipients,
|
||||||
|
'host' => $team->smtp_host,
|
||||||
|
'port' => $team->smtp_port,
|
||||||
|
'encryption' => $team->smtp_encryption,
|
||||||
|
'username' => $team->smtp_username,
|
||||||
|
'password' => $team->smtp_password,
|
||||||
|
'timeout' => $team->smtp_timeout,
|
||||||
|
];
|
||||||
|
$team->smtp_notifications = [
|
||||||
|
'test' => $team->smtp_notifications_test,
|
||||||
|
'deployments' => $team->smtp_notifications_deployments,
|
||||||
|
'status_changes' => $team->smtp_notifications_status_changes,
|
||||||
|
];
|
||||||
|
$team->discord = [
|
||||||
|
'enabled' => $team->discord_enabled,
|
||||||
|
'webhook_url' => $team->discord_webhook_url,
|
||||||
|
];
|
||||||
|
$team->discord_notifications = [
|
||||||
|
'test' => $team->discord_notifications_test,
|
||||||
|
'deployments' => $team->discord_notifications_deployments,
|
||||||
|
'status_changes' => $team->discord_notifications_status_changes,
|
||||||
|
];
|
||||||
|
$team->save();
|
||||||
|
}
|
||||||
|
Schema::table('teams', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('smtp_enabled');
|
||||||
|
$table->dropColumn('smtp_from_address');
|
||||||
|
$table->dropColumn('smtp_from_name');
|
||||||
|
$table->dropColumn('smtp_recipients');
|
||||||
|
$table->dropColumn('smtp_host');
|
||||||
|
$table->dropColumn('smtp_port');
|
||||||
|
$table->dropColumn('smtp_encryption');
|
||||||
|
$table->dropColumn('smtp_username');
|
||||||
|
$table->dropColumn('smtp_password');
|
||||||
|
$table->dropColumn('smtp_timeout');
|
||||||
|
$table->dropColumn('smtp_notifications_test');
|
||||||
|
$table->dropColumn('smtp_notifications_deployments');
|
||||||
|
$table->dropColumn('smtp_notifications_status_changes');
|
||||||
|
|
||||||
|
$table->dropColumn('discord_enabled');
|
||||||
|
$table->dropColumn('discord_webhook_url');
|
||||||
|
$table->dropColumn('discord_notifications_test');
|
||||||
|
$table->dropColumn('discord_notifications_deployments');
|
||||||
|
$table->dropColumn('discord_notifications_status_changes');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('instance_settings', function (Blueprint $table) {
|
||||||
|
$table->schemalessAttributes('smtp');
|
||||||
|
});
|
||||||
|
|
||||||
|
$instance_setting = InstanceSettings::get();
|
||||||
|
$instance_setting->smtp = [
|
||||||
|
'enabled' => $instance_setting->smtp_enabled,
|
||||||
|
'from_address' => $instance_setting->smtp_from_address,
|
||||||
|
'from_name' => $instance_setting->smtp_from_name,
|
||||||
|
'recipients' => $instance_setting->smtp_recipients,
|
||||||
|
'host' => $instance_setting->smtp_host,
|
||||||
|
'port' => $instance_setting->smtp_port,
|
||||||
|
'encryption' => $instance_setting->smtp_encryption,
|
||||||
|
'username' => $instance_setting->smtp_username,
|
||||||
|
'password' => $instance_setting->smtp_password,
|
||||||
|
'timeout' => $instance_setting->smtp_timeout,
|
||||||
|
];
|
||||||
|
$instance_setting->save();
|
||||||
|
Schema::table('instance_settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('smtp_enabled');
|
||||||
|
$table->dropColumn('smtp_from_address');
|
||||||
|
$table->dropColumn('smtp_from_name');
|
||||||
|
$table->dropColumn('smtp_recipients');
|
||||||
|
$table->dropColumn('smtp_host');
|
||||||
|
$table->dropColumn('smtp_port');
|
||||||
|
$table->dropColumn('smtp_encryption');
|
||||||
|
$table->dropColumn('smtp_username');
|
||||||
|
$table->dropColumn('smtp_password');
|
||||||
|
$table->dropColumn('smtp_timeout');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -16,14 +16,11 @@ public function run(): void
|
|||||||
InstanceSettings::create([
|
InstanceSettings::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'is_registration_enabled' => true,
|
'is_registration_enabled' => true,
|
||||||
'smtp' => [
|
'smtp_enabled' => true,
|
||||||
'enabled' => true,
|
'smtp_host' => 'coolify-mail',
|
||||||
'test_recipients' => 'test@example.com,test2@example.com',
|
'smtp_port' => 1025,
|
||||||
'host' => 'coolify-mail',
|
'smtp_from_address' => 'hi@localhost.com',
|
||||||
'port' => 1025,
|
'smtp_from_name' => 'Coolify',
|
||||||
'from_address' => 'hi@localhost.com',
|
|
||||||
'from_name' => 'Coolify',
|
|
||||||
]
|
|
||||||
]);
|
]);
|
||||||
try {
|
try {
|
||||||
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output();
|
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output();
|
||||||
|
@ -33,9 +33,15 @@ class="absolute inset-y-0 left-0 flex items-center pl-2 cursor-pointer hover:tex
|
|||||||
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}"
|
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}"
|
||||||
@disabled($readonly) @disabled($disabled) id="{{ $id }}"
|
@disabled($readonly) @disabled($disabled) id="{{ $id }}"
|
||||||
name="{{ $name }}">
|
name="{{ $name }}">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if (!$label && $helper)
|
@if (!$label && $helper)
|
||||||
<x-helper :helper="$helper" />
|
<x-helper :helper="$helper" />
|
||||||
@endif
|
@endif
|
||||||
|
@error($id)
|
||||||
|
<label class="label">
|
||||||
|
<span class="text-red-500 label-text-alt">{{ $message }}</span>
|
||||||
|
</label>
|
||||||
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<x-forms.button type="submit">
|
<x-forms.button type="submit">
|
||||||
Save
|
Save
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@if ($model->discord->enabled)
|
@if ($model->discord_enabled)
|
||||||
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
|
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
|
||||||
wire:click="sendTestNotification">
|
wire:click="sendTestNotification">
|
||||||
Send Test Notifications
|
Send Test Notifications
|
||||||
@ -13,23 +13,23 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="w-48">
|
<div class="w-48">
|
||||||
<x-forms.checkbox instantSave id="model.discord.enabled" label="Notification Enabled" />
|
<x-forms.checkbox instantSave id="model.discord_enabled" label="Notification Enabled" />
|
||||||
</div>
|
</div>
|
||||||
<x-forms.input type="string"
|
<x-forms.input type="string"
|
||||||
helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." required
|
helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." required
|
||||||
id="model.discord.webhook_url" label="Webhook" />
|
id="model.discord_webhook_url" label="Webhook" />
|
||||||
</form>
|
</form>
|
||||||
@if (data_get($model, 'discord.enabled'))
|
@if (data_get($model, 'discord_enabled'))
|
||||||
<h4 class="mt-4">Subscribe to events</h4>
|
<h4 class="mt-4">Subscribe to events</h4>
|
||||||
<div class="w-64 ">
|
<div class="w-64 ">
|
||||||
@if (isDev())
|
@if (isDev())
|
||||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications.test"
|
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_test"
|
||||||
label="Test Notifications" />
|
label="Test Notifications" />
|
||||||
@endif
|
@endif
|
||||||
<h5 class="mt-4">Applications</h5>
|
<h5 class="mt-4">Applications</h5>
|
||||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications.deployments"
|
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_deployments"
|
||||||
label="New Deployment" />
|
label="New Deployment" />
|
||||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications.status_changes"
|
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_status_changes"
|
||||||
label="Status Changes" />
|
label="Status Changes" />
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
@ -1,4 +1,15 @@
|
|||||||
<div>
|
<div>
|
||||||
|
<dialog id="sendTestEmail" class="modal">
|
||||||
|
<form method="dialog" class="flex flex-col gap-2 rounded modal-box" wire:submit.prevent='submit'>
|
||||||
|
<x-forms.input placeholder="test@example.com" id="emails" label="Recepients" required />
|
||||||
|
<x-forms.button onclick="sendTestEmail.close()" wire:click="sendTestNotification">
|
||||||
|
Send Test Emails
|
||||||
|
</x-forms.button>
|
||||||
|
</form>
|
||||||
|
<form method="dialog" class="modal-backdrop">
|
||||||
|
<button>close</button>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
<form wire:submit.prevent='submit' class="flex flex-col">
|
<form wire:submit.prevent='submit' class="flex flex-col">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<h2>Email</h2>
|
<h2>Email</h2>
|
||||||
@ -10,53 +21,50 @@
|
|||||||
Copy from Instance Settings
|
Copy from Instance Settings
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@endif
|
@endif
|
||||||
@if ($model->smtp->enabled)
|
@if ($model->smtp_enabled)
|
||||||
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
|
<x-forms.button onclick="sendTestEmail.showModal()"
|
||||||
wire:click="sendTestNotification">
|
class="text-white normal-case btn btn-xs no-animation btn-primary">
|
||||||
Send Test Notifications
|
Send Test Email
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="w-48">
|
<div class="w-48">
|
||||||
<x-forms.checkbox instantSave id="model.smtp.enabled" label="Notification Enabled" />
|
<x-forms.checkbox instantSave id="model.smtp_enabled" label="Notification Enabled" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 xl:flex-row">
|
<div class="flex flex-col gap-2 xl:flex-row">
|
||||||
<x-forms.input id="model.smtp.recipients" placeholder="If empty, all users will be notified in the team."
|
<x-forms.input id="model.smtp_recipients" placeholder="If empty, all users will be notified in the team."
|
||||||
helper="Email list to send the all notifications to, separated by comma." label="Recipients" />
|
helper="Email list to send the all notifications to, separated by comma." label="Recipients" />
|
||||||
<x-forms.input id="model.smtp.test_recipients" label="Test Notification Recipients"
|
|
||||||
placeholder="If empty, all users will be notified in the team."
|
|
||||||
helper="Email list to send the test notification to, separated by comma." />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2 xl:flex-row">
|
<div class="flex flex-col gap-2 xl:flex-row">
|
||||||
<x-forms.input required id="model.smtp.host" helper="SMTP Hostname" placeholder="smtp.mailgun.org"
|
<x-forms.input required id="model.smtp_host" helper="SMTP Hostname" placeholder="smtp.mailgun.org"
|
||||||
label="Host" />
|
label="Host" />
|
||||||
<x-forms.input required id="model.smtp.port" helper="SMTP Port" placeholder="587" label="Port" />
|
<x-forms.input required id="model.smtp_port" helper="SMTP Port" placeholder="587" label="Port" />
|
||||||
<x-forms.input helper="If SMTP through SSL, set it to 'tls'." placeholder="tls" id="model.smtp.encryption"
|
<x-forms.input helper="If SMTP through SSL, set it to 'tls'." placeholder="tls" id="model.smtp_encryption"
|
||||||
label="Encryption" />
|
label="Encryption" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2 xl:flex-row">
|
<div class="flex flex-col gap-2 xl:flex-row">
|
||||||
<x-forms.input id="model.smtp.username" helper="SMTP Username" label="SMTP Username" />
|
<x-forms.input id="model.smtp_username" helper="SMTP Username" label="SMTP Username" />
|
||||||
<x-forms.input type="password" helper="SMTP Password" id="model.smtp.password" label="SMTP Password" />
|
<x-forms.input type="password" helper="SMTP Password" id="model.smtp_password" label="SMTP Password" />
|
||||||
<x-forms.input id="model.smtp.timeout" helper="Timeout value for sending emails." label="Timeout" />
|
<x-forms.input id="model.smtp_timeout" helper="Timeout value for sending emails." label="Timeout" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2 xl:flex-row">
|
<div class="flex flex-col gap-2 xl:flex-row">
|
||||||
<x-forms.input required id="model.smtp.from_name" helper="Name used in emails." label="From Name" />
|
<x-forms.input required id="model.smtp_from_name" helper="Name used in emails." label="From Name" />
|
||||||
<x-forms.input required id="model.smtp.from_address" helper="Email address used in emails."
|
<x-forms.input required id="model.smtp_from_address" helper="Email address used in emails."
|
||||||
label="From Address" />
|
label="From Address" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@if (data_get($model, 'smtp.enabled'))
|
@if (data_get($model, 'smtp_enabled'))
|
||||||
<h4 class="mt-4">Subscribe to events</h4>
|
<h4 class="mt-4">Subscribe to events</h4>
|
||||||
<div class="w-64">
|
<div class="w-64">
|
||||||
@if (isDev())
|
@if (isDev())
|
||||||
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications.test"
|
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications_test"
|
||||||
label="Test Notifications" />
|
label="Test Notifications" />
|
||||||
@endif
|
@endif
|
||||||
<h5 class="mt-4">Applications</h5>
|
<h5 class="mt-4">Applications</h5>
|
||||||
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications.deployments"
|
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications_deployments"
|
||||||
label="New Deployment" />
|
label="New Deployment" />
|
||||||
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications.status_changes"
|
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications_status_changes"
|
||||||
label="Status Changes" />
|
label="Status Changes" />
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<x-forms.button type="submit">
|
<x-forms.button type="submit">
|
||||||
Save
|
Save
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@if ($settings->smtp->enabled)
|
@if ($settings->smtp_enabled)
|
||||||
<x-forms.button isHighlighted wire:click='testNotification'>
|
<x-forms.button isHighlighted wire:click='testNotification'>
|
||||||
Send Test Email
|
Send Test Email
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@ -13,28 +13,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="pt-2 pb-4 ">SMTP settings for password resets, invitations, etc.</div>
|
<div class="pt-2 pb-4 ">SMTP settings for password resets, invitations, etc.</div>
|
||||||
<div class="w-32">
|
<div class="w-32">
|
||||||
<x-forms.checkbox instantSave id="settings.smtp.enabled" label="Enabled" />
|
<x-forms.checkbox instantSave id="settings.smtp_enabled" label="Enabled" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-end gap-2">
|
<div class="flex items-end gap-2">
|
||||||
<x-forms.input id="settings.smtp.test_recipients" label="Test Recipients"
|
<x-forms.input id="settings.smtp_test_recipients" label="Test Recipients"
|
||||||
helper="Email list to send a test email to, separated by comma." />
|
helper="Email list to send a test email to, separated by comma." />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col w-full gap-2 xl:flex-row">
|
<div class="flex flex-col w-full gap-2 xl:flex-row">
|
||||||
<x-forms.input required id="settings.smtp.host" helper="SMTP Hostname" placeholder="smtp.mailgun.org"
|
<x-forms.input required id="settings.smtp_host" helper="SMTP Hostname" placeholder="smtp.mailgun.org"
|
||||||
label="Host" />
|
label="Host" />
|
||||||
<x-forms.input required id="settings.smtp.port" helper="SMTP Port" placeholder="587" label="Port" />
|
<x-forms.input required id="settings.smtp_port" helper="SMTP Port" placeholder="587" label="Port" />
|
||||||
<x-forms.input id="settings.smtp.encryption" helper="If SMTP through SSL, set it to 'tls'."
|
<x-forms.input id="settings.smtp_encryption" helper="If SMTP through SSL, set it to 'tls'."
|
||||||
placeholder="tls" label="Encryption" />
|
placeholder="tls" label="Encryption" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col w-full gap-2 xl:flex-row">
|
<div class="flex flex-col w-full gap-2 xl:flex-row">
|
||||||
<x-forms.input id="settings.smtp.username" helper="SMTP Username" label="SMTP Username" />
|
<x-forms.input id="settings.smtp_username" helper="SMTP Username" label="SMTP Username" />
|
||||||
<x-forms.input id="settings.smtp.password" type="password" helper="SMTP Password" label="SMTP Password" />
|
<x-forms.input id="settings.smtp_password" type="password" helper="SMTP Password" label="SMTP Password" />
|
||||||
<x-forms.input id="settings.smtp.timeout" helper="Timeout value for sending emails." label="Timeout" />
|
<x-forms.input id="settings.smtp_timeout" helper="Timeout value for sending emails." label="Timeout" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col w-full gap-2 xl:flex-row">
|
<div class="flex flex-col w-full gap-2 xl:flex-row">
|
||||||
<x-forms.input required id="settings.smtp.from_name" helper="Name used in emails." label="From Name" />
|
<x-forms.input required id="settings.smtp_from_name" helper="Name used in emails." label="From Name" />
|
||||||
<x-forms.input required id="settings.smtp.from_address" helper="Email address used in emails."
|
<x-forms.input required id="settings.smtp_from_address" helper="Email address used in emails."
|
||||||
label="From Address" />
|
label="From Address" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user