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">
<ul class="navbar-nav me-auto">
<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 class="nav-item">
<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);
if (session.success) {
if (session.rank! !== 2) {
await auth.logout();
localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`);
loadLoginForm();
}
loadUsersView();
if (!session.developer) {
await auth.logout();
localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`);
loadLoginForm();
}
elements.usersNavLink.style.display = "none";
loadBotsView();
} else loadUsersView();
loadAdminView();
} else {
localStorage.removeItem(`collabvm_session_${new URL(Config.APIEndpoint).host}`);