Repository navigation
Conversation
…er is never started The authoring tool records activity and subscribes to the session warning and forced logout, but since the AngularJS routes were removed in WISE-Community#1390 nothing calls SessionService.initializeSession() there, so the timer that renews the session, warns and logs out never runs. An author who makes no request for the session timeout loses the session without notice, and every later save is rejected while the page keeps accepting edits. AuthoringToolComponent now starts the timer on init and stops it on destroy. initializeSession() replaces any earlier timer, clears a stale warning flag, and does nothing when the session never expires. Only an explicit false from the renew endpoint logs out; the empty body it sends when the portal row cannot be read no longer ends the session. Dismissing the warning dialog without choosing No keeps the author logged in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The authoring tool never starts the session timer, so an author's session can expire while the page gives no sign of it. Every save after that is rejected, and the page keeps accepting edits.
SessionService.initializeSession()starts a one-minute timer that renews the session while the user is active, shows the "Session Timeout" warning before the timeout, and logs out after it.AuthoringToolComponentis wired for all of this: it records mouse, keyboard and touch activity withuserIsActive(), subscribes toshowSessionWarning$andlogOut$, and the author config it loads carriessessionTimeoutandrenewSessionURL. But nothing in the authoring tool callsinitializeSession(). The AngularJS route states called it after loading/api/author/config/<id>, and the call was not carried over when those states were replaced in #1390, so today only the student VLE starts the timer. The activity the authoring tool records is never read.In the authoring tool the session is therefore kept alive only by real requests. An author who reads, thinks, or edits a translation field for longer than the session timeout without saving loses the session silently. From then on every save returns 403. The page shows "Error Saving Unit. Please refresh the page.", and refreshing discards whatever was typed since. This was observed in production: after a 35-minute pause, an author working on English translations had five consecutive translation saves on five different steps rejected over eight minutes, and the server log shows no renew request during the whole visit.
Changes
AuthoringToolComponentcallsinitializeSession()inngOnInitand the newstopCheckMouseEvent()inngOnDestroy, so the timer lives exactly as long as the component that handles its events.initializeSession()stops any earlier timer before starting a new one, so entering the authoring tool again does not stack timers. It also clears a warning flag left over from an earlier visit, which would otherwise suppress the warning for the rest of the session, and it does not start the timer whensessionTimeoutis not positive (a session that never expires).renewSession()andcheckForLogout()log out only when the renew endpoint answersfalse.LoginController.renewSessionsends an empty body when the portal row cannot be read, whichHttpClientparses asnull; that previously counted as logged out, and with the timer running in authoring it would now be checked every minute.Two existing behaviours are unchanged and worth knowing. The forced-logout check calls the renew endpoint, which itself refreshes the server session, so a tab left idle keeps its session alive while showing the warning rather than being logged out. And the Classroom Monitor has the same missing
initializeSession()call; it is left out of this PR because starting the timer there changes what teachers see during a class (the warning dialog after an idle period) and deserves its own decision.Test
sessionService.spec.tsgains six cases: no timer when the session never expires, a single timer after repeated initialization, a stale warning cleared on initialization,stopCheckMouseEvent()stopping the timer, and no logout on an empty renew answer in bothrenewSession()andcheckForLogout(). They do not compile against the currentdevelopbecausestopCheckMouseEvent()is new; with only an emptystopCheckMouseEvent()added todevelop, all six fail. The existing cases pass, with one renamed because the preview stub it set up was never read.millisecondsToDateTime()indatetime.spec.ts, which expects US Pacific output and fails on a workstation in UTC+8 with a zh-TW locale; this branch does not touch it.