Issue Bug Under Review Quiet

#110908Backend re-login modal appears unreliably or far too late

Wolfgang Klinger 10/04/26, 16:01 updated 10/04/26, 16:26

Description

Problem

After the backend session expires, the re-login modal sometimes
appears and sometimes does not. In the second case the backend still
looks fine, but every AJAX action (page tree, context menu, drag and
drop, inline records, …) silently does nothing until the user
reloads the page.

Two causes:

  1. The session check runs on a fixed interval of sessionTimeout - 60
    seconds, counted from the moment the backend was loaded (since #76364,
    2016). The session itself expires sessionTimeout seconds after the
    *last request*. So the first check only catches the “about to expire“
    window if the user did nothing in the first 60 seconds after login.
    Otherwise the session expires unnoticed, and the next check comes
    another ~8 hours later (with the default timeout).
  2. When the session is gone, the BackendUserAuthenticator middleware
    answers AJAX routes with a bare 401. AjaxRequest rejects the promise
    and nothing in the backend reacts to it, so the user gets no hint.

Steps to reproduce

  1. Set $GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'] = 300.
  2. Log in to the backend and click around for two minutes.
  3. Wait five minutes without touching the backend.
  4. Right-click a page in the page tree: the context menu does not open, no modal is shown, no error is visible.

Expected

The “session about to expire” modal appears shortly before the session
expires, regardless of when the backend was loaded. If the session is
already gone, the first failed request opens the login form.

Fix

  • /ajax/login/timedout additionally returns expires_in (seconds
    until the session expires). The client schedules the next check from
    that value instead of polling on a fixed interval.
  • AjaxRequest dispatches typo3:ajax-request:unauthorized on the
    top frame for a 401 response. The login refresh module listens and
    shows the login form at once.

Reviews 1

History 01