Admin console: show the signed-in operator's name, not "Administrator"
The user switcher fell back to "Administrator" whenever /admin/api/status returned no currentUser. Fresh sign-ins already embed the verified Emby account name in the session cookie, but a session minted before that field existed (or one that has not been re-issued since) is valid yet anonymous, so the fallback showed for ever. handleAdminConsole now treats a valid-but-anonymous admin session as needing a fresh sign-in for the SPA shell only — a one-time prompt that fills the name in, since session renewal preserves whatever the cookie already held. Asset requests are unaffected, so nothing breaks mid-session. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011wS9Qz3Fkxeu9KPt26hhhx
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
d5632e844a
commit
0b1d329f7c
@@ -109,6 +109,14 @@ func (s *Server) handleAdminConsole(w http.ResponseWriter, r *http.Request) {
|
||||
s.renderAccessLogin(w, r, "", http.StatusOK, r.URL.Path)
|
||||
return
|
||||
}
|
||||
// A valid but anonymous session (minted before the cookie carried the operator's
|
||||
// name) leaves the console unable to say who is signed in. Prompt for the shell only,
|
||||
// so a fresh sign-in fills the name in without breaking asset requests mid-session.
|
||||
if isAdminDocumentRequest(r) && !s.adminSessionNamed(r) {
|
||||
s.renderAccessLogin(w, r, "Please sign in again to continue.",
|
||||
http.StatusOK, r.URL.Path)
|
||||
return
|
||||
}
|
||||
// Opening a page is somebody at the keyboard, so it starts the clock again.
|
||||
s.renewAdminSession(w, r)
|
||||
s.setAdminTokenCookie(w, r)
|
||||
|
||||
Reference in New Issue
Block a user