- tasks/ldap.yml keeps cn=Harmony (harmony@eom.dev): password from Vault, in Harmony Users, Postfix Users and Dovecot Users. GoTrue sends as it, and it is an instance admin alongside eric@eom.dev. - theme.js hides the e-mail/password form; Register and /register (also in Caddy) go to https://www.eom.dev/members/. - The Dex button uses the square eom.dev icon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.4 KiB
Django/Jinja
72 lines
2.4 KiB
Django/Jinja
/* SPDX-License-Identifier: MIT-0
|
|
* eom.dev: {{ harmony_instance_name }} signs in through Dex only.
|
|
*
|
|
* Loaded blocking from <head> by files/theme/theme.sh (/eom/theme.js).
|
|
* - Hides Harmony's e-mail/password form and its "or" divider on the sign-in
|
|
* and sign-up pages, whatever theme or skin is chosen. GoTrue refuses e-mail
|
|
* sign-in anyway (harmony_email_login: false); this only removes the dead UI.
|
|
* The OAuth button, the "Powered by Harmony" link and everything else stay.
|
|
* - Sends "Register" and any visit to /register to {{ harmony_signup_url }}:
|
|
* eom.dev accounts are made there, and the Harmony Users group decides who
|
|
* gets in. (Caddy redirects a direct load of /register as well.)
|
|
* Relies on Harmony {{ harmony_version }}'s src/components/AuthComponent.vue:
|
|
* data-testid="auth-form", ".oauth-section + .divider",
|
|
* data-testid="auth-switch-mode", and the /register route.
|
|
*/
|
|
(function () {
|
|
"use strict";
|
|
var SIGNUP = {{ harmony_signup_url | to_json }};
|
|
{% if not harmony_email_login | bool %}
|
|
|
|
var style = document.createElement("style");
|
|
style.id = "eom-sso-only";
|
|
style.textContent =
|
|
'[data-testid="auth-form"], .oauth-section + .divider { display: none !important; }';
|
|
document.head.appendChild(style);
|
|
{% endif %}
|
|
|
|
function isRegister(url) {
|
|
try {
|
|
return new URL(String(url), location.href).pathname.replace(/\/+$/, "") === "/register";
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function toSignup() {
|
|
location.assign(SIGNUP);
|
|
}
|
|
|
|
if (isRegister(location.href)) {
|
|
toSignup();
|
|
return;
|
|
}
|
|
|
|
// The SPA's router navigates with pushState/replaceState.
|
|
["pushState", "replaceState"].forEach(function (name) {
|
|
var original = history[name];
|
|
history[name] = function (state, title, url) {
|
|
if (url != null && isRegister(url)) {
|
|
toSignup();
|
|
return;
|
|
}
|
|
return original.apply(this, arguments);
|
|
};
|
|
});
|
|
|
|
// On the sign-in page, "Register" toggles the form in place; send it out.
|
|
document.addEventListener(
|
|
"click",
|
|
function (event) {
|
|
var target = event.target;
|
|
var button = target && target.closest && target.closest('[data-testid="auth-switch-mode"]');
|
|
if (button && !isRegister(location.href) && location.pathname.replace(/\/+$/, "") === "/login") {
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
toSignup();
|
|
}
|
|
},
|
|
true
|
|
);
|
|
})();
|