web interfaces: when there is no login session, and a non-existent path is requested, mention the web interface this is about

may help users understand when /admin/ isn't enabled on a hostname but the
account web interface is at /. the error will now say: no session for "account"
web interface. it hopefully tells users that their request isn't going to an
admin interface, but ends up at the account web interface.

for issue #268
This commit is contained in:
Mechiel Lukkien 2025-01-22 20:15:14 +01:00
parent f15f2d68fc
commit 7647264a72
No known key found for this signature in database

View file

@ -125,7 +125,7 @@ func Check(ctx context.Context, log mlog.Log, sessionAuth SessionAuth, kind stri
// Cookies are named "webmailsession", "webaccountsession", "webadminsession".
cookie, _ := r.Cookie(kind + "session")
if cookie == nil {
respondAuthError("user:noAuth", "no session")
respondAuthError("user:noAuth", fmt.Sprintf("no session for %q web interface", strings.TrimPrefix(kind, "web")))
return "", "", "", false
}