diff --git a/administrator/components/com_menus/src/Controller/MenusController.php b/administrator/components/com_menus/src/Controller/MenusController.php
index 935906a981a30..3bde6a0490a23 100644
--- a/administrator/components/com_menus/src/Controller/MenusController.php
+++ b/administrator/components/com_menus/src/Controller/MenusController.php
@@ -115,6 +115,8 @@ public function delete()
* @return void
*
* @since 1.6
+ *
+ * @deprecated 5.0 Will be removed without replacement as it was only used for the 1.5 to 1.6 upgrade
*/
public function resync()
{
diff --git a/build/media_source/plg_system_webauthn/js/login.es6.js b/build/media_source/plg_system_webauthn/js/login.es6.js
index 97047b50c7344..ee98feee2409c 100644
--- a/build/media_source/plg_system_webauthn/js/login.es6.js
+++ b/build/media_source/plg_system_webauthn/js/login.es6.js
@@ -120,10 +120,8 @@ window.Joomla = window.Joomla || {};
* internal page which handles the login server-side.
*
* @param { Object} publicKey Public key request options, returned from the server
- * @param {String} callbackUrl The URL we will use to post back to the server. Must include
- * the anti-CSRF token.
*/
- const handleLoginChallenge = (publicKey, callbackUrl) => {
+ const handleLoginChallenge = (publicKey) => {
const arrayToBase64String = (a) => btoa(String.fromCharCode(...a));
const base64url2base64 = (input) => {
@@ -172,7 +170,8 @@ window.Joomla = window.Joomla || {};
};
// Send the response to your server
- window.location = `${callbackUrl}&option=com_ajax&group=system&plugin=webauthn&`
+ const paths = Joomla.getOptions('system.paths');
+ window.location = `${paths ? `${paths.base}/index.php` : window.location.pathname}?${Joomla.getOptions('csrf.token')}=1&option=com_ajax&group=system&plugin=webauthn&`
+ `format=raw&akaction=login&encoding=redirect&data=${
btoa(JSON.stringify(publicKeyCredential))}`;
})
@@ -187,13 +186,11 @@ window.Joomla = window.Joomla || {};
* for the user.
*
* @param {string} formId The login form's or login module's HTML ID
- * @param {string} callbackUrl The URL we will use to post back to the server. Must include
- * the anti-CSRF token.
*
* @returns {boolean} Always FALSE to prevent BUTTON elements from reloading the page.
*/
// eslint-disable-next-line no-unused-vars
- Joomla.plgSystemWebauthnLogin = (formId, callbackUrl) => {
+ Joomla.plgSystemWebauthnLogin = (formId) => {
// Get the username
const elFormContainer = document.getElementById(formId);
const elUsername = lookForField(elFormContainer, 'input[name=username]');
@@ -226,9 +223,14 @@ window.Joomla = window.Joomla || {};
username,
returnUrl,
};
+ postBackData[Joomla.getOptions('csrf.token')] = 1;
+
+ const paths = Joomla.getOptions('system.paths');
Joomla.request({
- url: callbackUrl,
+ url: `${paths ? `${paths.base}/index.php` : window.location.pathname}?${Joomla.getOptions(
+ 'csrf.token',
+ )}=1`,
method: 'POST',
data: interpolateParameters(postBackData),
onSuccess(rawResponse) {
@@ -243,7 +245,7 @@ window.Joomla = window.Joomla || {};
*/
}
- handleLoginChallenge(jsonData, callbackUrl);
+ handleLoginChallenge(jsonData);
},
onError: (xhr) => {
handleLoginError(`${xhr.status} ${xhr.statusText}`);
@@ -258,7 +260,7 @@ window.Joomla = window.Joomla || {};
if (loginButtons.length) {
loginButtons.forEach((button) => {
button.addEventListener('click', ({ currentTarget }) => {
- Joomla.plgSystemWebauthnLogin(currentTarget.getAttribute('data-webauthn-form'), currentTarget.getAttribute('data-webauthn-url'));
+ Joomla.plgSystemWebauthnLogin(currentTarget.getAttribute('data-webauthn-form'));
});
});
}
diff --git a/build/media_source/plg_system_webauthn/js/management.es6.js b/build/media_source/plg_system_webauthn/js/management.es6.js
index ea07097d71c29..546130ae73bac 100644
--- a/build/media_source/plg_system_webauthn/js/management.es6.js
+++ b/build/media_source/plg_system_webauthn/js/management.es6.js
@@ -84,7 +84,8 @@ window.Joomla = window.Joomla || {};
}
const publicKey = JSON.parse(atob(elStore.dataset.public_key));
- const postURL = atob(elStore.dataset.postback_url);
+ const paths = Joomla.getOptions('system.paths');
+ const postURL = `${paths ? `${paths.base}/index.php` : window.location.pathname}`;
const arrayToBase64String = (a) => btoa(String.fromCharCode(...a));
@@ -137,6 +138,7 @@ window.Joomla = window.Joomla || {};
encoding: 'raw',
data: btoa(JSON.stringify(publicKeyCredential)),
};
+ postBackData[Joomla.getOptions('csrf.token')] = 1;
Joomla.request({
url: postURL,
@@ -183,12 +185,13 @@ window.Joomla = window.Joomla || {};
return false;
}
- const postURL = atob(elStore.dataset.postback_url);
+ const paths = Joomla.getOptions('system.paths');
+ const postURL = `${paths ? `${paths.base}/index.php` : window.location.pathname}`;
// Find the UI elements
const elTR = that.parentElement.parentElement;
const credentialId = elTR.dataset.credential_id;
- const elTDs = elTR.querySelectorAll('td');
+ const elTDs = elTR.querySelectorAll('.webauthnManagementCell');
const elLabelTD = elTDs[0];
const elButtonsTD = elTDs[1];
const elButtons = elButtonsTD.querySelectorAll('button');
@@ -220,6 +223,7 @@ window.Joomla = window.Joomla || {};
credential_id: credentialId,
new_label: elNewLabel,
};
+ postBackData[Joomla.getOptions('csrf.token')] = 1;
Joomla.request({
url: postURL,
@@ -293,7 +297,8 @@ window.Joomla = window.Joomla || {};
return false;
}
- const postURL = atob(elStore.dataset.postback_url);
+ const paths = Joomla.getOptions('system.paths');
+ const postURL = `${paths ? `${paths.base}/index.php` : window.location.pathname}`;
// Find the UI elements
const elTR = that.parentElement.parentElement;
@@ -317,6 +322,7 @@ window.Joomla = window.Joomla || {};
akaction: 'delete',
credential_id: credentialId,
};
+ postBackData[Joomla.getOptions('csrf.token')] = 1;
Joomla.request({
url: postURL,
diff --git a/layouts/plugins/system/webauthn/manage.php b/layouts/plugins/system/webauthn/manage.php
index 63b6e99bbc944..f08ecb9f116f5 100644
--- a/layouts/plugins/system/webauthn/manage.php
+++ b/layouts/plugins/system/webauthn/manage.php
@@ -12,10 +12,9 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
-use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\User\UserHelper;
-use Joomla\Plugin\System\Webauthn\Helper\CredentialsCreation;
+use Joomla\Plugin\System\Webauthn\Authentication;
use Joomla\Plugin\System\Webauthn\Helper\Joomla;
/**
@@ -79,15 +78,14 @@
* that problem.
*/
$randomId = 'plg_system_webauthn_' . UserHelper::genRandomPassword(32);
+/** @noinspection PhpInternalEntityUsedInspection */
// phpcs:ignore
-$publicKey = $allow_add ? base64_encode(CredentialsCreation::createPublicKey($user)) : '{}';
-$postbackURL = base64_encode(rtrim(Uri::base(), '/') . '/index.php?' . Joomla::getToken() . '=1');
+$publicKey = $allow_add ? base64_encode(json_encode(Authentication::getPubKeyCreationOptions($user))) : '{}';
?>
- |
-
+ | |
+
|