From 4595db209eea2ff12c09ecb8cbc4eafced64fb69 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Tue, 26 May 2026 16:29:56 -0500 Subject: [PATCH] feat: show current IP above trusted IPs table Display the admin's current IP address with a hint to add it, making it easy to configure trusted IP entries without looking up the IP separately. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + .../Field/CurrentIpField.php | 40 +++++++++++++++++++ src/packages/plg_system_mokowaas/mokowaas.xml | 6 +++ 3 files changed, 47 insertions(+) create mode 100644 src/packages/plg_system_mokowaas/Field/CurrentIpField.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d949b54..5e3e140 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Trusted IPs: configurable repeatable rows of IP addresses, CIDR ranges, and wildcards that bypass admin session timeout - Supports exact IPs (192.168.1.100), CIDR (10.0.0.0/24), and wildcards (192.168.1.*) - Each entry has a label and enabled toggle for easy management +- Current IP display above trusted IPs table so admins can easily add their own IP ## [02.06.00] - 2026-05-25 diff --git a/src/packages/plg_system_mokowaas/Field/CurrentIpField.php b/src/packages/plg_system_mokowaas/Field/CurrentIpField.php new file mode 100644 index 0000000..6de6e00 --- /dev/null +++ b/src/packages/plg_system_mokowaas/Field/CurrentIpField.php @@ -0,0 +1,40 @@ + + * + * SPDX-LICENSE-IDENTIFIER: GPL-3.0-or-later + * + * FILE INFORMATION + * DEFGROUP: Joomla.Plugin + * INGROUP: MokoWaaS + * VERSION: 02.11.00 + * PATH: /src/Field/CurrentIpField.php + * BRIEF: Read-only field that displays the current user's IP address + */ + +namespace Moko\Plugin\System\MokoWaaS\Field; + +defined('_JEXEC') or die; + +use Joomla\CMS\Form\FormField; + +class CurrentIpField extends FormField +{ + protected $type = 'CurrentIp'; + + protected function getInput() + { + $currentIp = $_SERVER['REMOTE_ADDR'] ?? 'unknown'; + + return '
' + . 'Your current IP: ' + . '' . htmlspecialchars($currentIp) . ' ' + . '— add this to the table below to keep your session alive.' + . '
'; + } + + protected function getLabel() + { + return ''; + } +} diff --git a/src/packages/plg_system_mokowaas/mokowaas.xml b/src/packages/plg_system_mokowaas/mokowaas.xml index 1eb7123..b293d94 100644 --- a/src/packages/plg_system_mokowaas/mokowaas.xml +++ b/src/packages/plg_system_mokowaas/mokowaas.xml @@ -310,6 +310,7 @@
+