Skip to content

Commit

Permalink
redirect to login after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickFuereder committed Jul 10, 2024
1 parent 93d1be9 commit b549ad0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Assets/js/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ document.getElementById('ca_twitch_link').addEventListener('click', () => LinkAc
document.getElementById('ca_discord_link').addEventListener('click', () => LinkAccounts('discord'));
document.getElementById('ca_google_link').addEventListener('click', () => LinkAccounts('google'));
document.getElementById('ca_github_link').addEventListener('click', () => LinkAccounts('github'));
document.getElementById('logout').addEventListener('click', () => LoginManager.logout());
document.getElementById('logout').addEventListener('click', async () => {
await LoginManager.logout();
window.location.href = 'https://login.netdb.at?redirect=' + encodeURIComponent(window.location.href);
});
document.getElementById('deleteAccount').addEventListener('click', async (e) => await doubleClickButton(e, deleteAccount));
document.getElementById('createSsoCredentials').addEventListener('click', async () => await createSsoCredentials());

Expand Down Expand Up @@ -599,11 +602,12 @@ function createApiKeyRow(client_id) {
async function createApiKey() {
await LoginManager.validateToken();
const req = await fetch('https://api.login.netdb.at/user/apikey', {
method: 'GET',
method: 'POST',
headers: {
Authorization: 'Bearer ' + LoginManager.getCookie('token'),
'Content-Type': 'application/json',
},
body: "admin"
});

if (req.status == 401) {
Expand Down

0 comments on commit b549ad0

Please sign in to comment.