X-Git-Url: https://git.squeep.com/?p=squeep-authentication-module;a=blobdiff_plain;f=lib%2Ftemplate%2Flogin-html.js;fp=lib%2Ftemplate%2Flogin-html.js;h=d6a45f5be36053cc4e2b96f2ac6fde479b1fdf50;hp=7d059e0d505caf4d4fb503f554dcd91d9d05ccc3;hb=328932bc7484022cb9b2de808cbf18ecd5d7f206;hpb=9a7d5352698481c0857ba8827e31c7cb97625133
diff --git a/lib/template/login-html.js b/lib/template/login-html.js
index 7d059e0..d6a45f5 100644
--- a/lib/template/login-html.js
+++ b/lib/template/login-html.js
@@ -15,6 +15,7 @@ function indieAuthSection(ctx, options) {
\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t\t\t
+\t\t\t\t\t\t
\t\t\t\t\t\t
${indieAuthBlurb}
\t\t\t\t\t
@@ -24,6 +25,44 @@ ${indieAuthBlurb}
}
+/**
+ * Default all URL inputs to https if scheme not specified,
+ * and set a flag if that happened.
+ * From https://aaronparecki.com/2019/05/13/2/https
+ */
+function indieAuthURLTrySecureFirstScript(ctx, options) {
+ const showIndieAuthForm = options.authnEnabled.includes('indieAuth');
+ return showIndieAuthForm ? `
+` : '';
+}
+
const userAuthn = ['argon2', 'pam', 'DEBUG_ANY'];
function userSection(ctx, options) {
const userBlurb = (options.userBlurb || []).map((x) => '\t'.repeat(6) + x).join('\n');
@@ -78,6 +117,7 @@ module.exports = (ctx, options) => {
};
const mainContent = [
...(options.authenticator.loginBlurb || []),
+ indieAuthURLTrySecureFirstScript(ctx, htmlOptions),
indieAuthSection(ctx, htmlOptions),
userSection(ctx, htmlOptions),
];