Send the admin login straight to Dex

A public custom script submits the OIDC form on /admin/login and CSS
hides the password form. /admin/login?local=1 (or a failed password
attempt) shows it for break-glass use; a 15s guard prevents loops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 21:05:40 -05:00
co-authored by Claude Opus 5.5
parent e4a3d13870
commit baa2d4b521
4 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ Deploys [listmonk](https://listmonk.app) v6.2.0, the eom.dev newsletter, to Kube
It fits in with the rest of eom.dev:
- **Login** goes through Dex (`listmonk` static client) with the same "eom.dev account" button as the other services. Only e-mail addresses listed in `listmonk_oidc_admins` can sign in, so being a member is not enough to get into the admin UI. A password login for the `admin` user is kept as a fallback.
- **Login** goes through Dex (`listmonk` static client) with the same "eom.dev account" button as the other services. Only e-mail addresses listed in `listmonk_oidc_admins` can sign in, so being a member is not enough to get into the admin UI. The admin login page sends you straight to Dex. For the `admin` password login, kept as a fallback for when Dex is down, use `/admin/login?local=1`.
- **Mail** goes out through `postfix.eom.dev:587` as the LDAP account `news`, the same way Gitea, Nextcloud and PeerTube send mail.
- **Look**: the public pages (subscribe, archive, preferences, unsubscribe) use the Catppuccin Mocha/Latte palette from `dex.eom.dev`, along with the eom.dev logo and favicon.
- **Cluster conventions**: `ca-issuer` TLS, `nfs-client` volumes, and anti-affinity that keeps the pods off the ingress-nginx node.
+3
View File
@@ -71,3 +71,6 @@ input::placeholder { color: var(--muted); }
.button.button-outline:hover { background: var(--surface); color: var(--accent-hover); }
.error { color: var(--error); }
.pg-page.pg-selected { background: var(--accent); color: var(--on-accent); }
/* Admin login is Dex only; ?local=1 (public.js) reveals the password form. */
.login form[action="/admin/login"], .login .center.small { display: none; }
.eom-local-login .login form[action="/admin/login"], .eom-local-login .login .center.small { display: block; }
+20
View File
@@ -0,0 +1,20 @@
// eom.dev: the admin login goes straight to Dex.
// Break-glass password login: /admin/login?local=1
(function () {
if (window.location.pathname !== "/admin/login") return;
var local = new URLSearchParams(window.location.search).has("local");
var go = function () {
var root = document.documentElement;
// A failed password attempt re-renders /admin/login without ?local=1.
if (local || document.querySelector(".login .error")) { root.classList.add("eom-local-login"); return; }
var form = document.querySelector('form[action="/auth/oidc"]');
if (!form) return;
// Don't loop if Dex sent us straight back (e.g. login refused).
var key = "eom-oidc-redirect", now = Date.now(), last = 0;
try { last = Number(sessionStorage.getItem(key)) || 0; sessionStorage.setItem(key, String(now)); } catch (e) {}
if (now - last < 15000) return;
form.submit();
};
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", go);
else go();
})();
+1
View File
@@ -52,6 +52,7 @@
}],
'appearance.public.custom_css': lookup('ansible.builtin.file', role_path ~ '/files/public.css'),
'appearance.admin.custom_css': lookup('ansible.builtin.file', role_path ~ '/files/admin.css'),
'appearance.public.custom_js': lookup('ansible.builtin.file', role_path ~ '/files/public.js'),
} | combine(listmonk_settings_extra) -%}
\set ON_ERROR_STOP on
BEGIN;