diff --git a/source/packages/com_mokosuiteclient/admin/src/View/Dashboard/HtmlView.php b/source/packages/com_mokosuiteclient/admin/src/View/Dashboard/HtmlView.php index a0899a8f..1e85f947 100644 --- a/source/packages/com_mokosuiteclient/admin/src/View/Dashboard/HtmlView.php +++ b/source/packages/com_mokosuiteclient/admin/src/View/Dashboard/HtmlView.php @@ -26,6 +26,7 @@ class HtmlView extends BaseHtmlView protected $wafChartData = []; protected $loginChartData = []; protected $mokoExtensions = []; + public $supportPin = ''; public function display($tpl = null) { @@ -33,6 +34,28 @@ class HtmlView extends BaseHtmlView $this->plugins = $model->getFeaturePlugins(); $this->siteInfo = $model->getSiteInfo(); + + // Daily support PIN from health token + try + { + $db = \Joomla\CMS\Factory::getDbo(); + $db->setQuery( + $db->getQuery(true) + ->select($db->quoteName('params')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('element') . ' = ' . $db->quote('mokosuiteclient')) + ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) + ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) + ); + $token = (json_decode((string) $db->loadResult()))->health_api_token ?? ''; + + if (!empty($token)) + { + $hash = hash_hmac('sha256', gmdate('Y-m-d'), $token); + $this->supportPin = 'MOKO-' . strtoupper(substr($hash, 0, 4)) . '-' . strtoupper(substr($hash, 4, 4)); + } + } + catch (\Throwable $e) {} $this->recentLogins = $model->getRecentLogins(5); $this->pendingUpdates = $model->getPendingUpdates(); $this->checkedOutItems = $model->getCheckedOutItems(); diff --git a/source/packages/com_mokosuiteclient/admin/tmpl/dashboard/default.php b/source/packages/com_mokosuiteclient/admin/tmpl/dashboard/default.php index 483da496..161f75b0 100644 --- a/source/packages/com_mokosuiteclient/admin/tmpl/dashboard/default.php +++ b/source/packages/com_mokosuiteclient/admin/tmpl/dashboard/default.php @@ -48,6 +48,12 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api']; MokoSuiteClient escape($siteInfo->mokosuiteclient_version); ?> + supportPin)): ?> +