luci-base: improve login/logout handling