Commit 4b194105 authored by Matthieu Fesselier's avatar Matthieu Fesselier

Merge branch 'fix/timeout-limit' into 'master'

bugfix: limit timeout to avoid immediate logout

See merge request !17
parents 08bd1c7e 27fd5767
Pipeline #5270 passed with stage
in 52 seconds
...@@ -31,9 +31,10 @@ class SIBAuth extends HTMLElement { ...@@ -31,9 +31,10 @@ class SIBAuth extends HTMLElement {
if (await this.getUserWebId()) { if (await this.getUserWebId()) {
this.dispatchUserInfo(); this.dispatchUserInfo();
} }
const session = await new Promise(a => auth.trackSession(a)); const session = await this.trackSession();
if (!session) return; if (!session) return;
const timeout = session.idClaims.exp * 1000 - Date.now(); const timeout = session.idClaims.exp * 1000 - Date.now();
if (timeout > 1000 * 60 * 60 * 24 * 2) return; // 2 days
setTimeout(() => { setTimeout(() => {
this.logout(); this.logout();
}, timeout); }, timeout);
......
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