Commit d3bbc89f authored by Nicolas Pernoud's avatar Nicolas Pernoud
Browse files

fix: redirection loop after cookie expires

parent 3d49f59a
Pipeline #14499 passed with stages
in 2 minutes and 34 seconds
...@@ -97,8 +97,7 @@ export class Login { ...@@ -97,8 +97,7 @@ export class Login {
if (response.status !== 200) { if (response.status !== 200) {
throw new Error(`Login error (status ${response.status})`); throw new Error(`Login error (status ${response.status})`);
} }
const newUser = await Auth.GetUser(); await Auth.GetUser();
Object.assign(this.user, newUser);
location.hash = "#davs"; location.hash = "#davs";
this.navbar.CreateMenu(); this.navbar.CreateMenu();
} catch (e) { } catch (e) {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<div class="navbar-brand"> <div class="navbar-brand">
<div class="navbar-item"> <div class="navbar-item">
<a class="button is-primary is-rounded is-outlined" href="https://www.github.com/nicolaspernoud/Vestibule" target="_blank" rel="noopener noreferrer"> <a class="button is-primary is-rounded is-outlined" href="https://www.github.com/nicolaspernoud/Vestibule" target="_blank" rel="noopener noreferrer">
<span>4.5.12</span> <span>4.5.13</span>
<span class="icon"> <span class="icon">
<svg <svg
class="svg-inline--fa fa-github fa-w-16" class="svg-inline--fa fa-github fa-w-16"
......
...@@ -14,7 +14,7 @@ export async function GetUser() { ...@@ -14,7 +14,7 @@ export async function GetUser() {
if (response.status !== 200) { if (response.status !== 200) {
throw new Error(`Not authenticated (status ${response.status})`); throw new Error(`Not authenticated (status ${response.status})`);
} }
user = await response.json(); Object.assign(user, await response.json());
// Redirect to original subdomain if login was displayed after an authentication error on the original subdomain // Redirect to original subdomain if login was displayed after an authentication error on the original subdomain
try { try {
const redirectAfterLogin = document.cookie const redirectAfterLogin = document.cookie
...@@ -33,5 +33,7 @@ export async function GetUser() { ...@@ -33,5 +33,7 @@ export async function GetUser() {
} }
export function DeleteUser() { export function DeleteUser() {
user = {}; Object.keys(user).forEach((key) => {
delete user[key];
});
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment