fix login bug

This commit is contained in:
Elijah R 2024-04-07 20:09:16 -04:00
parent 61de380588
commit c7bca43b44
2 changed files with 9 additions and 6 deletions

View file

@ -18,7 +18,7 @@
<div class="collapse navbar-collapse" id="navbarNav" style="display:none!important"> <div class="collapse navbar-collapse" id="navbarNav" style="display:none!important">
<ul class="navbar-nav me-auto"> <ul class="navbar-nav me-auto">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" href="#" id="usersNavLink">Users</a> <a class="nav-link" href="#" id="usersNavLink">Users</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#" id="botsNavLink">Bots</a> <a class="nav-link" href="#" id="botsNavLink">Bots</a>

View file

@ -236,11 +236,14 @@ elements.createBotForm.addEventListener('submit', async e => {
var session = await auth.loadSession(token); var session = await auth.loadSession(token);
if (session.success) { if (session.success) {
if (session.rank! !== 2) { if (session.rank! !== 2) {
await auth.logout(); if (!session.developer) {
localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`); await auth.logout();
loadLoginForm(); localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`);
} loadLoginForm();
loadUsersView(); }
elements.usersNavLink.style.display = "none";
loadBotsView();
} else loadUsersView();
loadAdminView(); loadAdminView();
} else { } else {
localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`); localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`);