Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

support for relays without authentication and encryption (#662)

Igor Rzegocki153a6a48c0d2
diff --git a/admin.php b/admin.php
index 031fa8d..e035401 100644
--- a/admin.php
+++ b/admin.php
@@ -194,9 +194,14 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;
class="one-third" value="<?= $settings['smtp_port'] ?>" />
</div>
<div class="form-group-inline">
+ <div>
+ <input type="radio" name="encryption" id="encryptionnone" value="none"
+ <?= empty($settings['encryption']) || $settings['encryption'] == "none" ? "checked" : "" ?> />
+ <label for="encryptionnone"><?= translate('none', $i18n) ?></label>
+ </div>
<div>
<input type="radio" name="encryption" id="encryptiontls" value="tls"
- <?= empty($settings['encryption']) || $settings['encryption'] == "tls" ? "checked" : "" ?> />
+ <?= $settings['encryption'] == "tls" ? "checked" : "" ?> />
<label for="encryptiontls"><?= translate('tls', $i18n) ?></label>
</div>
<div>
@@ -245,7 +250,7 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;
}
// find unused upload logos
-
+
// Get all logos in the subscriptions table
$query = 'SELECT logo FROM subscriptions';
$stmt = $db->prepare($query);
@@ -396,4 +401,4 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;
<?php
require_once 'includes/footer.php';
-?>
\ No newline at end of file
+?>
diff --git a/endpoints/cronjobs/sendcancellationnotifications.php b/endpoints/cronjobs/sendcancellationnotifications.php
index b07cba3..544c079 100644
--- a/endpoints/cronjobs/sendcancellationnotifications.php
+++ b/endpoints/cronjobs/sendcancellationnotifications.php
@@ -197,15 +197,21 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {
$message .= $subscription['name'] . " for " . $subscription['price'] ."\n";
}
+ $smtpAuth = (isset($email["smtpUsername"]) && $email["smtpUsername"] != "") || (isset($email["smtpPassword"]) && $email["smtpPassword"] != "");
+
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->isSMTP();
$mail->Host = $email['smtpAddress'];
- $mail->SMTPAuth = true;
- $mail->Username = $email['smtpUsername'];
- $mail->Password = $email['smtpPassword'];
- $mail->SMTPSecure = $email['encryption'];
+ $mail->SMTPAuth = $smtpAuth;
+ if ($smtpAuth) {
+ $mail->Username = $email['smtpUsername'];
+ $mail->Password = $email['smtpPassword'];
+ }
+ if ($email['encryption'] != "none") {
+ $mail->SMTPSecure = $email['encryption'];
+ }
$mail->Port = $email['smtpPort'];
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
@@ -501,4 +507,4 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {
}
-?>
\ No newline at end of file
+?>
diff --git a/endpoints/cronjobs/sendnotifications.php b/endpoints/cronjobs/sendnotifications.php
index aa76020..0f403dc 100644
--- a/endpoints/cronjobs/sendnotifications.php
+++ b/endpoints/cronjobs/sendnotifications.php
@@ -266,15 +266,21 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {
$message .= $subscription['name'] . " for " . $subscription['price'] . " (" . $dayText . ")\n";
}
+ $smtpAuth = (isset($email["smtpUsername"]) && $email["smtpUsername"] != "") || (isset($email["smtpPassword"]) && $email["smtpPassword"] != "");
+
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->isSMTP();
$mail->Host = $email['smtpAddress'];
- $mail->SMTPAuth = true;
- $mail->Username = $email['smtpUsername'];
- $mail->Password = $email['smtpPassword'];
- $mail->SMTPSecure = $email['encryption'];
+ $mail->SMTPAuth = $smtpAuth;
+ if ($smtpAuth) {
+ $mail->Username = $email['smtpUsername'];
+ $mail->Password = $email['smtpPassword'];
+ }
+ if ($email['encryption'] != "none") {
+ $mail->SMTPSecure = $email['encryption'];
+ }
$mail->Port = $email['smtpPort'];
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
@@ -711,4 +717,4 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {
}
-?>
\ No newline at end of file
+?>
diff --git a/endpoints/cronjobs/sendresetpasswordemails.php b/endpoints/cronjobs/sendresetpasswordemails.php
index c25c41f..39d2318 100644
--- a/endpoints/cronjobs/sendresetpasswordemails.php
+++ b/endpoints/cronjobs/sendresetpasswordemails.php
@@ -30,6 +30,7 @@ if ($rows) {
$fromEmail = empty($admin['from_email']) ? '[email protected]' : $admin['from_email'];
$encryption = $admin['encryption'];
$server_url = $admin['server_url'];
+ $smtpAuth = (isset($admin["smtp_username"]) && $admin["smtp_username"] != "") || (isset($admin["smtp_password"]) && $admin["smtp_password"] != "");
require __DIR__ . '/../../libs/PHPMailer/PHPMailer.php';
require __DIR__ . '/../../libs/PHPMailer/SMTP.php';
@@ -38,10 +39,14 @@ if ($rows) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = $smtpAddress;
- $mail->SMTPAuth = true;
- $mail->Username = $smtpUsername;
- $mail->Password = $smtpPassword;
- $mail->SMTPSecure = $encryption;
+ $mail->SMTPAuth = $smtpAuth;
+ if ($smtpAuth) {
+ $mail->Username = $smtpUsername;
+ $mail->Password = $smtpPassword;
+ }
+ if ($encryption != "none") {
+ $mail->SMTPSecure = $encryption;
+ }
$mail->Port = $smtpPort;
$mail->setFrom($fromEmail);
@@ -86,4 +91,4 @@ if ($rows) {
exit();
}
-?>
\ No newline at end of file
+?>
diff --git a/endpoints/cronjobs/sendverificationemails.php b/endpoints/cronjobs/sendverificationemails.php
index aab55bd..d491724 100644
--- a/endpoints/cronjobs/sendverificationemails.php
+++ b/endpoints/cronjobs/sendverificationemails.php
@@ -37,6 +37,7 @@ if ($rows) {
$fromEmail = empty($admin['from_email']) ? '[email protected]' : $admin['from_email'];
$encryption = $admin['encryption'];
$server_url = $admin['server_url'];
+ $smtpAuth = (isset($admin["smtp_username"]) && $admin["smtp_username"] != "") || (isset($admin["smtp_password"]) && $admin["smtp_password"] != "");
require __DIR__ . '/../../libs/PHPMailer/PHPMailer.php';
require __DIR__ . '/../../libs/PHPMailer/SMTP.php';
@@ -45,10 +46,14 @@ if ($rows) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = $smtpAddress;
- $mail->SMTPAuth = true;
- $mail->Username = $smtpUsername;
- $mail->Password = $smtpPassword;
- $mail->SMTPSecure = $encryption;
+ $mail->SMTPAuth = $smtpAuth;
+ if ($smtpAuth) {
+ $mail->Username = $smtpUsername;
+ $mail->Password = $smtpPassword;
+ }
+ if ($encryption != "none") {
+ $mail->SMTPSecure = $encryption;
+ }
$mail->Port = $smtpPort;
$mail->setFrom($fromEmail);
@@ -92,4 +97,4 @@ if ($rows) {
exit();
}
-?>
\ No newline at end of file
+?>
diff --git a/endpoints/notifications/saveemailnotifications.php b/endpoints/notifications/saveemailnotifications.php
index 4c76d06..a2e5fbe 100644
--- a/endpoints/notifications/saveemailnotifications.php
+++ b/endpoints/notifications/saveemailnotifications.php
@@ -14,9 +14,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
if (
!isset($data["smtpaddress"]) || $data["smtpaddress"] == "" ||
- !isset($data["smtpport"]) || $data["smtpport"] == "" ||
- !isset($data["smtpusername"]) || $data["smtpusername"] == "" ||
- !isset($data["smtppassword"]) || $data["smtppassword"] == ""
+ !isset($data["smtpport"]) || $data["smtpport"] == ""
) {
$response = [
"success" => false,
@@ -86,4 +84,4 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
}
}
}
-?>
\ No newline at end of file
+?>
diff --git a/endpoints/notifications/testemailnotifications.php b/endpoints/notifications/testemailnotifications.php
index 94c13f1..85aa418 100644
--- a/endpoints/notifications/testemailnotifications.php
+++ b/endpoints/notifications/testemailnotifications.php
@@ -19,9 +19,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
if (
!isset($data["smtpaddress"]) || $data["smtpaddress"] == "" ||
- !isset($data["smtpport"]) || $data["smtpport"] == "" ||
- !isset($data["smtpusername"]) || $data["smtpusername"] == "" ||
- !isset($data["smtppassword"]) || $data["smtppassword"] == ""
+ !isset($data["smtpport"]) || $data["smtpport"] == ""
) {
$response = [
"success" => false,
@@ -29,11 +27,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
];
die(json_encode($response));
} else {
- $enxryption = "tls";
+ $encryption = "none";
if (isset($data["encryption"])) {
$encryption = $data["encryption"];
}
+ $smtpAuth = (isset($data["smtpusername"]) && $data["smtpusername"] != "") || (isset($data["smtppassword"]) && $data["smtppassword"] != "");
+
require '../../libs/PHPMailer/PHPMailer.php';
require '../../libs/PHPMailer/SMTP.php';
require '../../libs/PHPMailer/Exception.php';
@@ -49,10 +49,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$mail->isSMTP();
$mail->Host = $smtpAddress;
- $mail->SMTPAuth = true;
- $mail->Username = $smtpUsername;
- $mail->Password = $smtpPassword;
- $mail->SMTPSecure = $encryption;
+ $mail->SMTPAuth = $smtpAuth;
+ if ($smtpAuth) {
+ $mail->Username = $smtpUsername;
+ $mail->Password = $smtpPassword;
+ }
+
+ if ($encryption != "none") {
+ $mail->SMTPSecure = $encryption;
+ }
$mail->Port = $smtpPort;
$getUser = "SELECT * FROM user WHERE id = 1";
@@ -84,10 +89,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
"message" => translate('email_error', $i18n) . $e->getMessage()
];
}
-
+
die(json_encode($response));
}
}
-?>
\ No newline at end of file
+?>
diff --git a/settings.php b/settings.php
index a37119b..1b11eca 100644
--- a/settings.php
+++ b/settings.php
@@ -22,7 +22,7 @@ $userData['currency_symbol'] = "€";
}
</style>
<section class="contain settings">
-
+
<section class="account-section">
<header>
<h2><?= translate('monthly_budget', $i18n) ?></h2>
@@ -358,6 +358,11 @@ $userData['currency_symbol'] = "€";
class="one-third" value="<?= $notificationsEmail['smtp_port'] ?>" />
</div>
<div class="form-group-inline">
+ <div>
+ <input type="radio" name="encryption" id="encryptionnone" value="none"
+ <?= $notificationsEmail['encryption'] == "none" ? "checked" : "" ?> />
+ <label for="encryptionnone"><?= translate('none', $i18n) ?></label>
+ </div>
<div>
<input type="radio" name="encryption" id="encryptiontls" value="tls"
<?= $notificationsEmail['encryption'] == "tls" ? "checked" : "" ?> />
@@ -1224,4 +1229,4 @@ $userData['currency_symbol'] = "€";
<?php
require_once 'includes/footer.php';
-?>
\ No newline at end of file
+?>