fix: make sure resend is false if SMTP is true and vice versa
This commit is contained in:
parent
2aacb1dc28
commit
67438e28ca
1 changed files with 67 additions and 53 deletions
|
|
@ -126,8 +126,9 @@ public function instantSave(string $type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitSmtp(): void
|
public function submitSmtp()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'smtpEnabled' => 'boolean',
|
'smtpEnabled' => 'boolean',
|
||||||
'smtpFromAddress' => 'required|email',
|
'smtpFromAddress' => 'required|email',
|
||||||
|
|
@ -149,6 +150,7 @@ public function submitSmtp(): void
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->resendEnabled = false;
|
$this->resendEnabled = false;
|
||||||
|
$this->settings->resend_enabled = false;
|
||||||
|
|
||||||
$this->settings->smtp_enabled = $this->smtpEnabled;
|
$this->settings->smtp_enabled = $this->smtpEnabled;
|
||||||
$this->settings->smtp_host = $this->smtpHost;
|
$this->settings->smtp_host = $this->smtpHost;
|
||||||
|
|
@ -159,14 +161,20 @@ public function submitSmtp(): void
|
||||||
$this->settings->smtp_timeout = $this->smtpTimeout;
|
$this->settings->smtp_timeout = $this->smtpTimeout;
|
||||||
$this->settings->smtp_from_address = $this->smtpFromAddress;
|
$this->settings->smtp_from_address = $this->smtpFromAddress;
|
||||||
$this->settings->smtp_from_name = $this->smtpFromName;
|
$this->settings->smtp_from_name = $this->smtpFromName;
|
||||||
$this->settings->resend_enabled = false;
|
|
||||||
$this->settings->save();
|
$this->settings->save();
|
||||||
|
|
||||||
$this->dispatch('success', 'SMTP settings updated.');
|
$this->dispatch('success', 'SMTP settings updated.');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->smtpEnabled = false;
|
||||||
|
|
||||||
|
return handleError($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitResend(): void
|
public function submitResend()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'resendEnabled' => 'boolean',
|
'resendEnabled' => 'boolean',
|
||||||
'resendApiKey' => 'required|string',
|
'resendApiKey' => 'required|string',
|
||||||
|
|
@ -180,15 +188,21 @@ public function submitResend(): void
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->smtpEnabled = false;
|
$this->smtpEnabled = false;
|
||||||
|
$this->settings->smtp_enabled = false;
|
||||||
|
|
||||||
$this->settings->resend_enabled = $this->resendEnabled;
|
$this->settings->resend_enabled = $this->resendEnabled;
|
||||||
$this->settings->resend_api_key = $this->resendApiKey;
|
$this->settings->resend_api_key = $this->resendApiKey;
|
||||||
$this->settings->smtp_from_address = $this->smtpFromAddress;
|
$this->settings->smtp_from_address = $this->smtpFromAddress;
|
||||||
$this->settings->smtp_from_name = $this->smtpFromName;
|
$this->settings->smtp_from_name = $this->smtpFromName;
|
||||||
$this->settings->smtp_enabled = false;
|
|
||||||
$this->settings->save();
|
$this->settings->save();
|
||||||
|
|
||||||
$this->dispatch('success', 'Resend settings updated.');
|
$this->dispatch('success', 'Resend settings updated.');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->resendEnabled = false;
|
||||||
|
|
||||||
|
return handleError($e, $this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendTestEmail()
|
public function sendTestEmail()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue