mirror of
https://github.com/pi-hole/web.git
synced 2026-04-28 04:33:58 +01:00
Replace inline onclick with addEventListener inside .js file to be compatible with CSP (v6) (#3104)
This commit is contained in:
15
scripts/pi-hole/js/logout.js
Normal file
15
scripts/pi-hole/js/logout.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2023 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* global utils:false */
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const logoutButton = document.getElementById("logout-button");
|
||||
logoutButton.addEventListener("click", () => {
|
||||
utils.doLogout();
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,7 @@
|
||||
]]--
|
||||
mg.include('header.lp','r')
|
||||
?>
|
||||
<script src="<?=pihole.fileversion('scripts/pi-hole/js/logout.js')?>"></script>
|
||||
<script src="<?=pihole.fileversion('scripts/vendor/select2.min.js')?>"></script>
|
||||
<script src="<?=pihole.fileversion('scripts/vendor/datatables.min.js')?>"></script>
|
||||
<script src="<?=pihole.fileversion('scripts/vendor/datatables.select.min.js')?>"></script>
|
||||
@@ -85,7 +86,7 @@ mg.include('header.lp','r')
|
||||
<a class="btn-link" href="https://github.com/pi-hole" rel="noopener" target="_blank"><i class="fa-fw menu-icon fab fa-github"></i> GitHub</a>
|
||||
<a class="btn-link" href="https://discourse.pi-hole.net/c/announcements/5" rel="noopener" target="_blank"><i class="fa-fw menu-icon fa-solid fa-rocket"></i> Pi-hole Releases</a>
|
||||
<? if pihole.needLogin() then ?>
|
||||
<a class="btn-link" href="#" onclick="utils.doLogout();"><i class="fa-fw menu-icon fa-solid fa-arrow-right-from-bracket"></i> Log out</a>
|
||||
<a class="btn-link" href="#" id="logout-button"><i class="fa-fw menu-icon fa-solid fa-arrow-right-from-bracket"></i> Log out</a>
|
||||
<? end ?>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user