support interaction between module and apps for updating templates before rendering
[squeep-authentication-module] / lib / template / ia-html.js
index 5de476ae04b880d2d94e6e3b1bd3db359aee2095..8a27479eb8426e4a3df658f9b71d382414754556 100644 (file)
@@ -1,6 +1,7 @@
 'use strict';
 
 const { TemplateHelper: th } = require('@squeep/html-template-helper');
+const { sessionNavLinks } = require('./helpers');
 
 /**
  *
@@ -23,10 +24,13 @@ function mainContent() {
  * @param {String} options.manager.pageTitle
  * @param {Object} options.dingus
  * @param {String} options.dingus.selfBaseUrl
+ * @param {(pagePathLevel, ctx, htmlOptions) => {void}} appCb
  * @returns {String}
  */
-module.exports = (ctx, options) => {
+module.exports = (ctx, options, appCb = () => {}) => {
+  const pagePathLevel = 1;
   const htmlOptions = {
+    pageIdentifier: 'indieAuthError',
     pageTitle: options.manager.pageTitle,
     logoUrl: options.manager.logoUrl,
     footerEntries: options.manager.footerEntries,
@@ -34,11 +38,14 @@ module.exports = (ctx, options) => {
       '<p>Problems were encountered while trying to authenticate your profile URL.</p>',
     ],
   };
+  appCb(pagePathLevel, ctx, htmlOptions);
+  sessionNavLinks(pagePathLevel, ctx, htmlOptions);
+
   // Ensure there is always an error to report, even if we do not have one, as we ended up here somehow.
   if (!ctx?.errors?.length) {
     ctx.errors = [
       'Unknown Error &mdash; we are not sure what just happened',
     ];
   }
-  return th.htmlPage(2, ctx, htmlOptions, mainContent());
+  return th.htmlPage(pagePathLevel, ctx, htmlOptions, mainContent());
 };
\ No newline at end of file