Skip to content

Commit

Permalink
basic settings access when not logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
Flolon committed Jan 24, 2025
1 parent 91975f5 commit 4303b08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class HeaderComponent extends HTMLElement {
<div class="loggedout headerDropdown">
<button class="menuElement" id="menulogin">Login</button>
<button class="menuElement" id="menuregister">Register</button>
<a class="menuElement" id="menusettings" href="/settings.html">Settings</a>
</div>
<div class="loggedin headerDropdown hidden">
<a class="menuElement" id="menueditprofile" href="/editprofile.html">Edit profile</a>
Expand Down
13 changes: 12 additions & 1 deletion js/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let selectedTab = location.hash.slice(1) || "security";
let loggedIn;
let isMobile;
let tfaEnabled = false;

Expand Down Expand Up @@ -85,7 +86,9 @@ window.addEventListener("load", async () => {
}
updateInfo();
} else {
location.href = "/";
// location.href = "/";
switchTab($("#tab-display"));
$("#sideContentLoading").classList.add("hidden");
}
});
$(".sidebarItems li").forEach(item => {
Expand Down Expand Up @@ -115,6 +118,10 @@ window.addEventListener("load", async () => {
});

$("#changepasswordbutton").addEventListener("click", () => {
if (!api.loggedIn) {
document.querySelector("stibarc-login-modal").show();
return;
}
window.scrollTo(0, 0);
$("#changepasswordformcontainer").classList.remove("hidden");
$("#overlay").classList.remove("hidden");
Expand Down Expand Up @@ -154,6 +161,10 @@ window.addEventListener("load", async () => {
}
});
$("#tfabutton").addEventListener("click", async () => {
if (!api.loggedIn) {
document.querySelector("stibarc-login-modal").show();
return;
}
window.scrollTo(0, 0);
$("#overlay").classList.remove("hidden");
$("#pleaseWait").classList.remove("hidden");
Expand Down

0 comments on commit 4303b08

Please sign in to comment.