mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-09-20 10:10:23 +00:00
This adds optional two factor authentication based on shared TOTP-secrets to both login variants (password and AIO token authentication). The 2FA can be enabled as soon as the containers are running in a section below the backup configuration. As long as it is not enabled, the AIO UI shows a warning at the top, and inside the Nextcloud a notification is shown to all Nextcloud admins, strongly recommending to enable it. The Nextcloud admin notification is sent via the mastercontainer's `cron.sh`, thus will be renewed whenever it is dismissed. In order to show the notices, this PR includes a notification system for the AIO UI, providing two variants: notices, and warnings. Notices have a green background and border and vanish after 5 seconds. Warnings have a orange-leaning yellow background and border and don't vanish (and can't be dismissed manually, neither). Another visual improvement is highlighted section headlines: If the URL hash matches an `h2` element's ID, the `h2` is highlighted and if the `h2` is followed by a `detail` element, that `detail` is opened. If effect, browsing to `#two-factor-auth` jumps to the section, which is highlighted and opened already (as shown in the second screenshot below). Signed-off-by: Pablo Zmdl <pablo@nextcloud.com> AI-assistant: Claude Opus 4.8
22 lines
627 B
JavaScript
22 lines
627 B
JavaScript
"use strict";
|
|
|
|
// Auto-dismisses temporary notifications (see NotificationService / notifications.twig)
|
|
// a few seconds after the page loads. Permanent notifications are left untouched.
|
|
(function () {
|
|
const TIMEOUT_MS = 5000;
|
|
|
|
function dismissTemporaryNotifications() {
|
|
document.querySelectorAll(".notification--temporary").forEach(function (el) {
|
|
setTimeout(function () {
|
|
el.remove();
|
|
}, TIMEOUT_MS);
|
|
});
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", dismissTemporaryNotifications);
|
|
} else {
|
|
dismissTemporaryNotifications();
|
|
}
|
|
})();
|