Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
fix: redirect from dashboard to subscriptions for new users
Miguel Ribeiro3ecc160ccb73
diff --git a/README.md b/README.mdindex 0c0be77..0878330 100644--- a/README.md+++ b/README.md@@ -57,6 +57,8 @@ Wallos is a powerful, open-source, and self-hostable web application designed to- Statistics: Another perspective into your spendings.- Notifications: Wallos supports multiple notification methods (email, discord, pushover, telegram, gotify and webhooks). Get notified about your upcoming payments.- Multi Language support.+- OIDC with OAuth+- AI Recommendations with ChatGPT, Gemini or Local Ollama## Demodiff --git a/admin.php b/admin.phpindex b5c3790..ae74552 100644--- a/admin.php+++ b/admin.php@@ -260,8 +260,7 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;</div><div class="form-group-inline"><input type="checkbox" id="oidcPasswordLoginDisabled"- <?= $oidcSettings['password_login_disabled'] ? 'checked' : '' ?>- <?= $loginDisabledAllowed ? '' : 'disabled' ?> />+ <?= $oidcSettings['password_login_disabled'] ? 'checked' : '' ?> /><label for="oidcPasswordLoginDisabled"><?= translate('disable_password_login', $i18n) ?></label></div><div class="buttons">diff --git a/api/subscriptions/get_ical_feed.php b/api/subscriptions/get_ical_feed.phpindex 6340465..f311a74 100644--- a/api/subscriptions/get_ical_feed.php+++ b/api/subscriptions/get_ical_feed.php@@ -26,7 +26,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GETexit;}-function getPriceConverted($price, $currency, $database){$query = "SELECT rate FROM currencies WHERE id = :currency";diff --git a/api/subscriptions/get_monthly_cost.php b/api/subscriptions/get_monthly_cost.phpindex 2c38964..6e95526 100644--- a/api/subscriptions/get_monthly_cost.php+++ b/api/subscriptions/get_monthly_cost.php@@ -53,6 +53,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET$stmt->bindValue(':apiKey', $apiKey);$result = $stmt->execute();$user = $result->fetchArray(SQLITE3_ASSOC);+ // If the user is not found or the API key is invalid, return an error+ if (!$user) {+ echo json_encode([+ "success" => false,+ "title" => "Invalid API key",+ "notes" => ["User not found or API key invalid."]+ ]);+ exit;+ }$sql = "SELECT * FROM last_exchange_update";$result = $db->query($sql);@@ -70,7 +79,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET$currency = $result->fetchArray(SQLITE3_ASSOC);$currency_code = $currency['code'];$currency_symbol = $currency['symbol'];-+$title = date('F Y', strtotime($year . '-' . $month . '-01'));$monthlyCost = 0;@@ -150,7 +159,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET$formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY);$localizedMonthlyCost = $formatter->formatCurrency($monthlyCost, $currency_code);-+echo json_encode(['success' => true,'title' => $title,diff --git a/includes/checkredirect.php b/includes/checkredirect.phpnew file mode 100644index 0000000..636d929--- /dev/null+++ b/includes/checkredirect.php@@ -0,0 +1,16 @@+<?php++$currentPage = basename($_SERVER['PHP_SELF']);+if ($currentPage == 'index.php') {+ // Redirect to subscriptions page if no subscriptions exist+ $stmt = $db->prepare("SELECT COUNT(*) FROM subscriptions WHERE user_id = :userId");+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ $row = $result->fetchArray(SQLITE3_NUM);+ $subscriptionCount = $row[0];++ if ($subscriptionCount === 0) {+ header('Location: subscriptions.php');+ exit;+ }+}\ No newline at end of filediff --git a/includes/header.php b/includes/header.phpindex fee44ce..2251a18 100644--- a/includes/header.php+++ b/includes/header.php@@ -2,6 +2,7 @@require_once 'connect.php';require_once 'checkuser.php';require_once 'checksession.php';+require_once 'checkredirect.php';require_once 'currency_formatter.php';require_once 'i18n/languages.php';diff --git a/includes/version.php b/includes/version.phpindex c41e776..6736c50 100644--- a/includes/version.php+++ b/includes/version.php@@ -1,3 +1,3 @@<?php-$version = "v4.1.0";+$version = "v4.1.1";?>\ No newline at end of filediff --git a/index.php b/index.phpindex 458a010..7085127 100644--- a/index.php+++ b/index.php@@ -3,18 +3,6 @@require_once 'includes/header.php';require_once 'includes/getdbkeys.php';-// Redirect to subscriptions page if no subscriptions exist-$stmt = $db->prepare("SELECT COUNT(*) FROM subscriptions WHERE user_id = :userId");-$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);-$result = $stmt->execute();-$row = $result->fetchArray(SQLITE3_NUM);-$subscriptionCount = $row[0];--if ($subscriptionCount === 0) {- header('Location: subscriptions.php');- exit;-}-function formatPrice($price, $currencyCode, $currencies){$formattedPrice = CurrencyFormatter::format($price, $currencyCode);